Skip to Main Content
Essential ActionScript 3.0
book

Essential ActionScript 3.0

by Colin Moock
June 2007
Intermediate to advanced content levelIntermediate to advanced
948 pages
27h 2m
English
O'Reilly Media, Inc.
Content preview from Essential ActionScript 3.0

Chapter 12. Events and Event Handling

In general terms, an event is a noteworthy runtime occurrence that has the potential to trigger a response in a program. In ActionScript, events can be broken into two categories: built-in events, which describe changes to the state of the runtime environment, and custom events, which describe changes to the state of a program. For example, a built-in event might be the clicking of the mouse or the completion of a file-load operation. By contrast, a custom event might be the ending of a game or the submission of an answer in a quiz.

Events are ubiquitous in ActionScript. In fact, in a pure ActionScript program, once the main-class constructor method has finished executing, all subsequent code is triggered by events. Accordingly, ActionScript supports a rich event architecture that provides the foundation for both built-in and custom events.

Tip

ActionScript’s event architecture is based on the W3C Document Object Model (DOM) Level 3 Events Specification, available at http://www.w3.org/TR/DOM-Level-3-Events.

This chapter teaches the fundamentals of ActionScript’s event architecture, covering both how to respond to built-in events and how to implement custom events in an ActionScript program. Note, however, that this chapter covers event fundamentals only. Later, inChapter 21, we’ll study how ActionScript’s event architecture caters to display objects (objects that represent onscreen content). Then, in Chapter 22, we’ll examine a variety of specific ...

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

Essential ActionScript 2.0

Essential ActionScript 2.0

Colin Moock
The ActionScript 3.0 Quick Reference Guide

The ActionScript 3.0 Quick Reference Guide

Jen deHaan, David Stiller, Darren Richardson, Rich Shupe
ActionScript 3.0 Cookbook

ActionScript 3.0 Cookbook

Joey Lott, Darron Schall, Keith Peters

Publisher Resources

ISBN: 0596526946Errata