For more information on working with custom classes, see the following topics:
"About importing class files" on page 239
"Using a class file in Flash" on page 244
"Using methods and properties from a class file" on page 245
"About class members" on page 250
"About getter and setter methods" on page 255
"How the compiler resolves class references" on page 243
"About dynamic classes" on page 259
"About using encapsulation" on page 261
"About using the this keyword in classes" on page 262
A sample file on your hard disk demonstrates how to create a dynamic menu with XML data
and a custom class file. The sample calls the ActionScript
two parameters: the path to the XML menu file and a reference to the current timeline. The
rest of the functionality resides in a custom class file, XmlMenu.as.
You can find the sample source file, xmlmenu.fla, in the Samples folder on your hard disk.
On Windows, browse to boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript\XML_Menu.
On the Macintosh, browse to Macintosh HD/Applications/Macromedia Flash 8/Samples
and Tutorials/Samples/ActionScript/XML_Menu.
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:
Global classpath
Preferences dialog box (Edit > Preferences (Windows) or Flash > Preferences (Macintosh),
click ActionScript in the Category list, and then click ActionScript 2.0 Settings).
Document-level classpath
document. It is set in the Publish Settings dialog box (File > Publish Settings, select the
Flash tab, and then click the Settings button).
is a classpath that's shared by all Flash documents. You set it in the
is a classpath that you specifically define for a single Flash
About working with custom classes in an application
constructor and passes it
XmlMenu()
239
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?