Previous chapters have touched upon custom events, and you may have already tried your hand at creating custom events. This chapter goes into detail about how events work and creating your own events, and provides some tips on handling events and guidelines for event usage.
Since the Flex Framework relies so heavily on events, it is quite natural that your own programs should use events and, further, should use their own custom events.
Remember that the technology underlying Flex is the Flash Player. The Flash Player is an event-driven system. Flex simply makes its own custom events. Most of the events are found in the
mx.events package. The
ItemClickEvent used with
List is a common example.
A "custom" event is a class that extends the
flash.events.Event base class. The class includes its own special types.
A custom event is useless without its own event type, as event types are how events are distinguished. The
Eventclass has a
targetproperty is set to the object that initially dispatches the event. The
currentTargetproperty is the object that has just produced the event. For example, if a button is clicked deep within your application, the
targetproperty will be the button. If you intercepted the event by placing a
clickevent handler on a container that holds the button, the
currentTargetproperty will be that container.
You may be writing a component ...