• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 11. Working with Movie Clips > Assigning a class to a movie clip symbol

Assigning a class to a movie clip symbol

Using ActionScript 2.0, you can create a class that extends the behavior of the built-in MovieClip class and then use the Linkage Properties dialog box to assign that class to a movie clip library symbol. Whenever you create an instance of the movie clip to which the class is assigned, it assumes the properties and behaviors defined by the class assigned to it. (For more information about ActionScript 2.0, see “Example: Writing custom classes” on page 269.)

In a subclass of the MovieClip class, you can provide method definitions for the built-in MovieClip methods and event handlers, such as onEnterFrame and onRelease. In the following procedure, you’ll create a class called MoveRight that extends the MovieClip class; MoveRight defines an onPress handler that moves the clip 20 pixels to the right whenever the user clicks the movie clip. In the second procedure, you’ll create a movie clip symbol in a new Flash (FLA) document and assign the MoveRight class to that symbol.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint