Flash CS3 Documentation |
|||
| Learning ActionScript 2.0 in Adobe Flash > Classes > About working with custom classes in an application > About importing class files | |||
In order to use a class or interface that you've defined, Flash must locate the external ActionScript files that contain the class or interface definition so that it can import the file. The list of directories in which Flash searches for class, interface, function, and variable definitions is called the classpath. Flash has two classpath settings--a global classpath and a document-level classpath:
When you import class files, the following rules apply:
import statements can exist in the following locations: #include statement).
import flash.display.BitmapData;
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.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.
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00000774.html