Working with Movie Clips and Buttons

This section examines two familiar symbols in Flash: movie clips and buttons. As you will see when working with ActionScript 3.0, you also have an option to work with Sprite objects, of which MovieClip objects are a subclass. Likewise, you will need to know something about a new class called SimpleButton to work effectively with buttons. Both movie clips and buttons inherit a number of their classes from the DisplayObject class, and in looking at the properties of both classes, the inherited classes are listed as well.

MovieClip Objects

To get started, you have to re-orient your thinking about how movie clips created on the stage are connected to ActionScript. Essentially, when you convert a drawing into a MovieClip or Button, you are creating a class. The class name is whatever you give for the Symbol Name.

When you create a movie clip using the drawing tools (instead of creating it using ActionScript 3.0), the Symbol dialog box provides an "Export for ActionScript" checkbox. When you enable that option, the Symbol Name appears in the Class window, and the Base class shows the path to the class base. For example, Figure 8 shows what you would see if you name the symbol, Truck, and enable the "Export for ActionScript" checkbox.

Symbol names become class names for Movie clips and buttons

Figure 7. Symbol names become class names for Movie clips and buttons

To work with movie clips created on the stage with drawing ...

Get ActionScript 3.0 Programming: Overview, Getting Started, and Examples of New Concepts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.