Assigning a class to a movie clip symbol

In order to use a subclass of the MovieClip class, you must assign, or register, that class with a specific movie clip symbol. To do this, you can use the authoring tool or write your own ActionScript.

To automatically assign a class to a movie clip symbol:

  1. Select a movie clip symbol in the library (it could be an empty movie clip).
  2. Choose Linkage from the Library options menu.
  3. Select Export for ActionScript.
  4. In the Identifier field, enter a unique string to identify this symbol with ActionScript.
  5. In the ClassName field, enter the fully qualified class name of the class you want to assign to the symbol, then click OK.
  6. Note: The fully qualified class name includes the package path, if the class is contained in a package folder. For more information, see , "Organizing class files in packages," on page 139 and Fully qualified class references.

You can also "manually" assign class to movie clip using the ActionScript Object.registerClass() method. The registerClass method takes two parameters: the symbol linkage ID (which identifies the movie clip) and a fully qualified class name. For example, the following code assigns the class Ball to a movie clip that has the symbol linkage ID myBall:

Object.registerClass("myBall",Ball);

The symbol linkage ID must be enclosed in quotation marks.

To remove a custom class previously assigned to a movie clip, enter null for the class parameter.

To assign a custom class to a movie clip with ActionScript:

To remove a custom class assigned to a movie clip with ActionScript: