Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
At the root of event dispatching is the EventDispatcher class. You'll find that many classes in ActionScript 3.0 (including all display objects and many networking classes) already extend EventDispatcher, making the logistics of sending events quite convenient.
Let's walk through the process of triggering, dispatching, and receiving events. The first thing you need is an event dispatcher. In this example, let's create a Thermometer to measure temperatures. The Thermometer will also be able to notify anyone who's interested in the temperature. You'll do this by making Thermometer a subclass of EventDispatcher. You'll also add a public setter function for changing the temperature. In this setter, you'll call dispatchEvent(), defined in the superclass EventDispatcher, to notify other objects when the temperature changes: