Macromedia flex 2 Manual
About events
37
Using an event object
When a Flex component dispatches an event, it creates an event object, where the properties
of the event object contain information describing the event. An event listener takes this event
object as an argument and accesses the properties of the object to determine information
about the event.
of the event object contain information describing the event. An event listener takes this event
object as an argument and accesses the properties of the object to determine information
about the event.
The base class for all event objects is the
flash.events.Event
class. All event objects are instances
of the Event class, or instances of a subclass of the Event class.
The following table describes the public properties of the
Event
class. The Event class
implements these properties using getter methods:
Property
Type
Description
type
String
The name of the event; for example,
“click”
. The event
constructor sets this property.
target
EventDispatcher A reference to the component instance that dispatches the
event. This property is set by the
dispatchEvent()
method;
you cannot change this to a different object.
currentTarget
EventDispatcher A reference to the component instance that is actively
processing the Event object. The value of this property is
different from the value of the
different from the value of the
target
property during the
event capture and bubbling phase. For more information,
see
see
Chapter 5, “Using Events,”
in Flex 2 Developer’s Guide.
eventPhase
uint
The current phase in the event flow. The property might
contain the following values:
•
contain the following values:
•
EventPhase.CAPTURING_PHASE
: The capture phase
•
EventPhase.AT_TARGET
: The target phase
•
EventPhase.BUBBLING_PHASE
: The bubbling phase
bubbles
Boolean
Whether an event is a bubbling event. If the event can
bubble, the value for this property is
bubble, the value for this property is
true,
otherwise, it is
false
. You can optionally pass this property as a
constructor argument to the Event class. By default, most
event classes set this property to
event classes set this property to
false
. For more
information, see
Chapter 5, “Using Events,”
in Flex 2
Developer’s Guide.
cancelable
Boolean
Whether the event can be canceled. If the event can be
canceled, the value for this value is
canceled, the value for this value is
true,
otherwise, it is
false
. You can optionally pass this property as a
constructor argument to the Event class. By default, most
event classes set this property to
event classes set this property to
false
. For more
information, see
Chapter 5, “Using Events,”
in Flex 2
Developer’s Guide.