About working with custom classes in an application

In Writing custom class files, you created a custom class file. In the following 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 Writing custom class files.
  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 About setting and modifying the classpath. For a comparison and more information on importing class files, see About importing class files.
  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 Creating instances of classes in an example.

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 Data and Data Types and Syntax and Language Fundamentals.

For more information on working with custom classes, see the following topics:

For samples that demonstrates how to create a dynamic menu with XML data and a custom class file, see the Flash Samples page at www.adobe.com/go/learn_fl_samples. The sample calls the ActionScript XmlMenu() constructor and passes it two parameters: the path to the XML menu file and a reference to the current timeline. Download and decompress the Samples zip file and navigate to the ActionScript2.0/XML_Menu folder to access these samples:


Flash CS3