About the Event class

The flash.events.Event class is an ActionScript class with properties that contain information about the event that occurred. An Event object is an implicitly created object, similar to the way the request and response objects in a JavaServer Page (JSP) are implicitly created by the application server.

Flex creates an Event object each time an event is dispatched. You can use the Event object inside an event listener to access details about the event that was dispatched, or about the component that dispatched the event. Passing an Event object to, and using it in, an event listener is optional. However, if you want to access the Event object's properties inside your event listeners, you must pass the Event object to the listener.

Flex creates only one Event object when an event is dispatched. During the bubbling and capturing phases, Flex changes the values on the Event object as it moves up or down the display list, rather than creating a new Event object for each node.

Subtopics

About event subclasses

About event subclasses

There are many classes that extend the flash.events.Event class. These classes are defined mostly in the following two packages:

The mx.events package defines event classes that are specific to Flex controls, including the DataGridEvent, DragEvent, and ColorPickerEvent. The flash.events package describes events that are not unique to Flex but are instead defined by Flash Player. These event classes include MouseEvent, DataEvent, and TextEvent. All of these events are commonly used in Flex applications.

In addition to these packages, some packages also define their own event objects; for example, mx.messaging.events.ChannelEvent and mx.logging.LogEvent.

Child classes of the Event class have additional properties and methods that may be unique to them. In some cases you will want to use a more specific event type rather than the generic Event object so that you can access these unique properties or methods. For example, the LogEvent class has a getLevelString() method that the Event class does not.

For information on using Event subclasses, see Using event subclasses.


Flex 2.01

Take a survey