Adding a Prebuilt Behavior

Adding a behavior in Flash is similar to adding an action: In both cases, you add ActionScript code to the Actions panel. But in the case of adding an action, you have to type the ActionScript code; when you add a behavior to your animation, Flash types the code for you.

Top: Smiley as he first appears, before you move your mouse over his left squinched-up eye.Bottom: Because Smiley's left eye is a button symbol, mousing over it tells Flash to turn your arrow cursor into a pointing finger. Clicking Smiley's left eye lets you drag Smiley around the test window. He stays where you drop him (until you click his left eye and drag him again).

Figure 9-7. Top: Smiley as he first appears, before you move your mouse over his left squinched-up eye. Bottom: Because Smiley's left eye is a button symbol, mousing over it tells Flash to turn your arrow cursor into a pointing finger. Clicking Smiley's left eye lets you drag Smiley around the test window. He stays where you drop him (until you click his left eye and drag him again).

Adding a behavior actually requires a few more steps and clicks than it would take an experienced scripter to type a quick ActionScript from scratch. But behaviors let you reap the benefits of ActionScript without learning anything about scripting.

Flash includes only a couple dozen behaviors, one of which does the same thing as the ActionScript described in the previous section.

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.