O'Reilly logo

Essential ActionScript 3.0 by Colin Moock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Compiler Restrictions

When compiling ActionScript programs with the Flash authoring tool, Flex Builder, or mxmlc, bear in mind the following compiler restrictions:

  • The program's main class must be public.

  • In Flex Builder 2 and mxmlc, the program's main class must reside in the unnamed package.

  • The program's main class must extend either Sprite or MovieClip, as discussed in Chapter 6.

  • Every ActionScript source file (.as file) in the program must have exactly one externally visible definition. An "externally visible definition" is a class, variable, function, interface, or namespace that is defined as either internal or public within a package statement.

  • An ActionScript source file's name must match the name of its sole externally visible definition.

For example, the following source file would be considered illegal because it contains two externally visible classes:

package {
  public class A {
  }

  public class B {
  }
}

Likewise, the following source file would be considered illegal because it does not contain any externally visible definition.

class  C {
}

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required