O'Reilly logo

Flash 8: The Missing Manual by E. A. Vander Veer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tying Actions to Events

Flash keeps track of every event that occurs while your animation plays, beginning with the instant Flash Player loads your animation and continuing through every frame Flash plays, every button your audience clicks, every key they press— basically, just about everything that happens in (or to) your animation.

You can tie an action to any event. The following sections show you how to tie actions to the most common events: when your animation loads, and when your audience clicks a button, mouses over a hotspot, or chooses an option from a list.

Triggering an Event When Your Audience Clicks a Button

In Chapter 7, you saw how to create groovy-looking button symbols (and where to find the button symbols that come with Flash), as well as how to change the appearance of a button when someone mouses over it.

This section shows you how to tie a button to an action so that when your audience clicks the button, Flash does something.

The example below uses a quick and easy behavior to tell Flash to load an additional animation when your audience clicks a button. But you can substitute a different behavior (or your own custom ActionScript code) to tell Flash to go to a different frame in the current animation, load a Web page, play a sound—just about anything you like.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required