Adding an Action

For an action to work, you must attach it to something in your animation. You add an action to either an object (like a component or symbol) or a frame, depending on when you want Flash to perform the action.

In this section, you see an example of adding an action to an instance of a button symbol (Button Symbols), but the technique's the same no matter where you're putting the action. Just remember to select the object on the Stage—or a frame in the Timeline—and then create the action.

Note

Chapter 10 describes the differences between frame-and object-based actions and when you want to choose one over the other.

To add an action:

  1. Open the document hotspot_drag_begin.fla.

    You can download this example file from the "Missing CD" page at www.missingmanuals.com/cds. It has a drawing all ready for you to practice on. (For a working copy, download hotspot_drag.fla.)

  2. Choose Window → Properties → Properties to display the Property Inspector. On the Stage, click Smiley's left eye (see Figure 9-4).

    Flash highlights the instance of the leftEye button symbol and displays instance-related properties in the Properties tab of the Property Inspector.

    Because many ActionScript statements require you to refer to a symbol instance by name, you want to get in the habit of always typing in a short, meaningful instance name every time you drag an instance to the Stage. You may not need it, but if you do, it's there. And even if you don't end up referencing the instance name in ActionScript, it comes in handy as a reminder of which object you're tying your action to (see ).

    Figure 9-4. Because many ActionScript statements require you to refer to a symbol instance by name, you want to get in the habit of always typing in a short, meaningful instance name every time you drag an instance to the Stage. You may not ...

Get Flash CS3: The Missing Manual 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.