Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Events notify observing objects of interesting occurrences and give those observers a chance to react.
Events are used throughout the Flash Player API, especially for user input, and asynchronous operations such as network access.
Flash Player uses a lot of its own events, but you can also create and use your own.
A dispatcher fires event objects of a specific type. The event object knows its type and remembers the dispatcher as its target. The event then proceeds through the phases of the event flow, triggering the listeners of every object that has registered for the event.
Events are dispatched by an EventDispatcher subclass, or, rarely, a class that implements IEventDispatcher.
DisplayObject extends EventDispatcher so all display objects can fire events.
Use addEventListener() on a dispatcher to listen for events; call removeEventListener() to stop listening.
Event objects extend Event. Subclasses of Event can carry additional information about the event.
At minimum, Event objects are differentiated by type, which is normally stored as a static String constant of the event class.
Events that bubble can only be dispatched from objects currently on the display list.
The capture, target, and bubble phases proceed in order. In most cases, the target phase is used, and sometimes the bubble phase. Capture phase and event priority are used sparingly.
Events can be aborted out of the event flow, and some built-in events can be stopped from performing their default behavior.