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

The Compilation Process and the Classpath

When a .swf file is exported, the ActionScript compiler makes a list of all the classes that the .swf requires. Specifically, the list of required classes includes:

  • All classes referenced directly or indirectly by the program's main class

  • In the case of the Flash authoring tool, all the classes referenced directly or indirectly by the .swf's source .fla file (i.e., in frame scripts)

The compiler searches the filesystem for source .as files that correspond to all referenced classes, and compiles each source file into the .swf, in bytecode format. The set of folders in which the compiler searches for .as files is known as the classpath.

Class files that exist on the filesystem but are not required by the .swf are not compiled into the .swf, classes that are required but not found cause a compile-time error.

Each ActionScript authoring tool includes some folders in the classpath automatically and also allows you to specify directories that should be included in the classpath. For example, the Flash authoring tool automatically includes the folder containing the .swf 's source .fla file in a classpath. Likewise, Flex Builder 2 and mxmlc both automatically include the folder containing the program's main class in the classpath. For instructions on including other folders in the classpath, see the appropriate product's documentation.

The classpath is sometimes also referred to as the build path or the source path.

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