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 working with custom classes in an
application
In
"Writing custom class files" on page
sections, you use that class file in an application. At the minimum, the workflow for creating
classes involves the following steps:
1.
Define a class in an external ActionScript class file. For information on defining and
writing a class file, see
2.
Save the class file to a designated classpath directory (a location where Flash looks for
classes), or in the same directory as the application's FLA file. For more information on
setting the classpath, see
comparison and more information on importing class files, see
files" on page
239.
3.
Create an instance of the class in another script, either in a FLA document or an external
script file or by creating a subclass based on the original class. For more information on
creating an instance of a class, see
on page
278.
The following sections in this chapter contain code examples that you can use to become
familiar with creating classes in ActionScript 2.0. If you're not familiar with ActionScript 2.0,
please read
Chapter 4, "Data and Data Types," on page 71
Language Fundamentals," on page
238
Classes
235, you created a custom class file. In the following
"Writing custom class files" on page
"About setting and modifying the classpath" on page
"Creating instances of classes in an example"
113.
constructor and passes it
XmlMenu()
235.
"About importing class
and
Chapter 5, "Syntax and
240. For a
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?