Getting Help for Events and Event Listeners

Now that the Flash document is ready to go, it's time to write and register an event listener, but where do you start? Computers are fussy beasts and won't work properly unless everything is done their way. ActionScript is the same. Event handling uses specific words, punctuation, and even capitalization. Everything has to be just so, or your event will be a nonevent. For beginner ActionScript coders, one of the challenges is learning the right words to use to define and register particular events. This section explains what questions you need to ask as you're coding and where to find the answers.

The first question to ask is this: What type of event is going to serve as the trigger to set your actions in motion? In this case, the event is the movement of the mouse over an object named mcCircle, so this is a mouse-related event. With that bit of knowledge, you can consult ActionScript reference tools that list different types of events. You're looking for one that sounds like it deals with mouse events.

The best reference tool that's close at hand while you're ActionScripting is the ActionScript 3.0 and Components reference. Open it through the help menu: Help→Flash Help. Flash opens the help pages in the Adobe Help window, which works like a web browser, with Forward and Back buttons and such. When you first fire it up, the window lists several help systems you can use. In this case, click the link ActionScript 3.0 and Components.

This electronic ...

Get Flash CS5: The Missing Manual 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.