Using classes example

For those who are new to object-oriented programming, this section provides an overview of the workflow involved in creating and using classes in Flash. At a minimum, this workflow involves the following steps:

  1. Defining a class in an external ActionScript class file.
  2. Saving the class file to a designated classpath directory (a location where Flash looks for classes).
  3. Creating an instance of the class in another script, either in a Flash (FLA) document or an external script file, or creating a subclass based the original class.

Also discussed in this section is a new feature in ActionScript 2.0 called strict data typing, which lets you specify the data type for a variable, function parameter, or function return type.

Although this section discusses only classes, the general workflow is the same for using interfaces. For more information, see Creating and using interfaces.