EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 240

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
240 Classes
When you import class files, the following rules apply:
The import statements can exist in the following locations:
Anywhere before the class definition in class files
Anywhere in frame or object scripts
Anywhere in ActionScript files that you include in an application (using the #include
statement).
You import individual, packaged definitions using this syntax:
import flash.display.BitmapData;
You can import entire packages using the wildcard syntax:
import flash.display.*;
You can also include ActionScript code in a Flash document (FLA) file using an include
statement. The following rules apply to the
include statement:
include statements are essentially a copy and paste of the content inside the included
ActionScript file.
include statements inside ActionScript class files are relative to the subdirectory that
contains the file.
An include statement in a FLA file can only bring in code that is valid inside FLA files,
and the same goes for other places that
include statements can live. For example, if you
have an
include statement inside a class definition, only property and method definitions
can exist in the included ActionScript file:
// Foo.as
class Foo {
#include "FooDef.as"
}
// FooDef.as:
var fooProp;
function fooMethod() {}
trace("Foo"); // This statement is not permitted in a class definition.
For more information on the include statement, see #include directive in the
ActionScript 2.0 Language Reference. For more information on classpaths, see “About setting
and modifying the classpath” on page 240.
About setting and modifying the classpath
In order to use a class or interface that youve defined, Flash must locate the external
ActionScript files that contain the class or interface definition. The list of directories in which
Flash searches for class and interface definitions is called the classpath.

Table of Contents

Related product manuals