Chapter 7. Create an Event Handler

ActionScript is an event-driven language. This means that in order for anything to occur in your script, an event must be triggered by Flash Player. Events can be triggered by the system or by the user. Examples of system events include an external file finishing being loaded or the play head entering a frame. User-triggered events include the user moving his or her mouse, clicking the mouse button, or pressing a key on the keyboard.

You need two pieces in your code to deal with events: an event handler and an event listener. An event handler is nothing more than a function that describes what will occur when the event is triggered. Event handlers can calculate a total, increase a user's score, submit information ...

Get ActionScript®: Your visual blueprint™ for creating interactive projects in Flash® CS4 Professional 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.