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.
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. Here's how to make a button object draggable using a behavior:
Open the document hotspot_drag_begin.fla.
You can download this file from the book's "Missing CD" page. For a working copy, download drag_behavior.fla.
On the Stage, click Smiley's left eye.
Flash highlights the instance of the leftEye button symbol and displays instance-related ...