Skip to Main Content
Flash CS4: The Missing Manual
book

Flash CS4: The Missing Manual

by Chris Grover
November 2008
Beginner content levelBeginner
751 pages
26h 22m
English
O'Reilly Media, Inc.
Content preview from Flash CS4: The Missing Manual

Chapter 12. Controlling Actions with Events

In the previous chapter, you learned how to use ActionScript to move, transform, and change parts of your animation. But when something happens is just as important as the action itself. For example, you may want a movie object to start playing as soon as the Web page opens, or you may want to let your viewer decide when to watch it. You use events to control the actions in your animation. It’s as if your ActionScript program tells Flash: “When this (event) happens, do this (action).” The classic example is a button on the stage. The action statement says something like: “When this button gets clicked, go to Frame 25 of the movie clip, and then start playing.” You provide the programming that puts the people who view your Flash creations in the driver’s seat. Using events and event handlers, you can send your programs off into the world on their own, confident that they’ll behave.

This chapter explains how to use ActionScript to detect events when they happen and how to get your animations to perform specific actions as a result. Unlike previous versions, ActionScript 3.0 has one single way of handling all kinds of events. So, once you learn the basics, you’re all set to handle any event.

How Events Work

There are many different types of events. Some events—like a mouse click—are triggered by the people viewing your animation. Other events are simply occurrences in a Flash animation—like a movie clip reaching the last frame. The button is ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Flash CS5: The Missing Manual

Flash CS5: The Missing Manual

Chris Grover

Publisher Resources

ISBN: 9780596156770Supplemental ContentErrata Page