
373
USING FLASH CS4 PROFESSIONAL
ActionScript
•
Macintosh: Hard Disk/Users/
user
/Library/Application Support/Adobe/Flash
CS4/
language
/Configuration/ActionsPanel
Declare an ActionScript 3.0 document class
When you use ActionScript 3.0, a SWF file may have a top-level class associated with it. This class is called the
document class. When the SWF is loaded by Flash Player, an instance of this class is created to be the SWF file's top-
level object. This object of a SWF file can be an instance of any custom class you choose.
For example, a SWF file that implements a calendar component can associate its top level with a Calendar class, with
methods and properties appropriate to a calendar component. When the SWF is loaded, Flash Player creates an
instance of this Calendar class.
1
Deselect all objects on the Stage and in the Timeline by clicking a blank area of the Stage. This displays the
Document properties in the Property inspector.
2
Enter the filename of the ActionScript file for the class in the Document Class text box in the Property inspector.
Do not include the .as filename extension.
Note:
You can also enter the Document Class information in the Publish Settings dialog box.
Set the location of ActionScript files
To use an ActionScript class that you’ve defined, Flash must locate the external ActionScript files that contain the class
definition. The list of folders in which Flash searches for class definitions is called the
classpath
for ActionScript 2.0
and the
source path
for ActionScript 3.0. Classpaths and source paths exist at the application (global) or document
level. For more information about classpaths, see Classes in
Learning ActionScript 2.0 in Adobe Flash
or “Packages”
in
Programming ActionScript 3.0
.
You can set the following ActionScript locations in Flash:
•
ActionScript 2.0
•
Application level (available to all AS2 FLA files):
•
Classpath (set in ActionScript preferences)
•
Document level (available only to the FLA file that specifies this path):
•
Classpath (set in Publish Settings)
•
ActionScript 3.0
•
Application level (available to all AS3 FLA files):
•
Source path (set in ActionScript preferences)
•
Library path (set in ActionScript preferences)
•
External library path (set in ActionScript preferences)
•
Document level (available only to the FLA file that specifies these paths):
•
Source path (set in Publish Settings)
•
Library path (set in Publish Settings)
•
External library path (set in Publish Settings)
•
Document class (set in Document Property inspector)
In ActionScript 3.0, there are two additional paths that you can set to specify the locations of ActionScript resources.
Updated 5 March 2009