Chapter 34. Use ActionScript in Your Movie

Create Event Handlers and Listeners

No code in ActionScript can execute without an event occurring. Events include the playhead entering a frame; a MovieClip or other object being created; external data being loaded; or the user interacting with the movie by moving their mouse, clicking on something, or typing a key on the keyboard.

At any given time, there may be hundreds of events occurring in the movie, but they are all ignored unless you write code for them. Code to control events has two parts: an event handler and an event listener.

An event handler is a function that you create to respond to the event. The event handler always takes an argument, which is the event itself, and never returns a value. ...

Get Master Visually®: Dreamweaver® CS4 and 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.