Chapter 15. Understanding Actions and Event Handlers


  • Knowing events and event handlers

  • Adding interactivity with the Code Snippets panel

  • Understanding Flash actions

  • Using the Actions panel with Script Assist

  • Learning your first Flash actions

  • Executing actions with event handlers

  • Using navigateToURL

Interactivity in a Flash movie can broadly be thought of as the elements that react and respond to a user's activity or input. A user has many ways to give input to a Flash movie, and Flash has even more ways to react. But how does interactivity actually work? It all starts with actions and event handlers.

Actions and Event Handlers

Even the most complex interactivity in Flash is fundamentally composed of two basic parts: the behavior (what happens) and the cause of the behavior (what makes it happen). Here's a simple example: Suppose you have a looping soundtrack in a movie and a button that, when clicked, turns the soundtrack off. The behavior is the sound turning off, and the cause of the behavior is the mouse clicking the button. Another example is stopping an animation when it reaches a certain frame on its timeline. When the last keyframe of the animation is played (the cause), an action on that keyframe stops the animation (the behavior). In Flash, the building blocks of behaviors are referred to as actions.


Flash CS5 features an interactive authoring tool called the Behaviors panel. Our usage of the term behaviors in the preceding description should not be confused with ...

Get Flash® Professional CS5 Bible now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.