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:
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:
Object.registerClass("symbolID",className);
To remove a custom class assigned to a movie clip with ActionScript:
Object.registerClass("symbolID",null);