About working with custom classes in an application
241
When you create an ActionScript class file, you need to save the file to one of the directories
specified in the classpath or a subdirectory therein. (You can modify the classpath to include
the desired directory path). Otherwise, Flash won’t be able to resolve, that is, locate, the class
or interface specified in the script. Subdirectories that you create within a classpath directory
are called packages and let you organize your classes. (For more information on packages, see
“Creating and packaging your class files” on page 266
.)
Flash has two classpath settings: a
global classpath
and a
document-level classpath
. The global
classpath is a classpath that’s shared by all of your Flash documents. The document-level
classpath is a classpath that you specifically define for a single Flash document.
The global classpath applies to external ActionScript files and to FLA files, and you set it in
the Preferences dialog box (Windows: Edit > Preferences (Windows) or Flash > Preferences
(Macintosh), select ActionScript from the Category list, and then click ActionScript 2.0
Settings). You can set the document-level classpath in the Flash document’s Publish Settings
dialog box (File > Publish Settings, select the Flash tab, and then click the Settings button).
Using a global classpath
The global classpath is a classpath that’s shared by all of your Flash documents.
You can modify the global classpath using the Preferences dialog box. To modify the
document-level classpath setting, you use the Publish Settings dialog box for the FLA file. In
both cases, you can add absolute directory paths (for example,
C:/my_classes
) and relative
directory paths (for example, .
./my_classes
or “
.
”). The order of directories in the dialog
box reflects the order in which they are searched.
By default, the global classpath contains one absolute path and one relative path. The absolute
path is denoted by $(LocalData)/Classes in the Preferences dialog box. The location of the
absolute path is shown here:
■
Windows: Hard Disk\Documents and Settings\
user
\Local Settings\Application
Data\Macromedia\Flash 8\
language
\Configuration\Classes.
■
Macintosh: Hard Disk/Users/
user
/Library/Application Support/Macromedia/Flash 8/
language
/Configuration/Classes.
NO
TE
When you click the Check Syntax button above the Script pane while editing an
ActionScript file, the compiler looks only in the global classpath. ActionScript files aren't
associated with FLA files in Edit mode and don't have their own classpath.
NOT
E
Do not delete the absolute global classpath. Flash uses this classpath to access
built-in classes. If you accidentally delete this classpath, reinstate it by adding
$(LocalData)/Classes as a new classpath.
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...