Flash CS3 Documentation |
|||
| Using ActionScript 2.0 Components > Handling Component Events > About the event object | |||
The event object is an instance of the ActionScript Object class; it has the following properties that contain information about an event.
|
Property |
Description |
|---|---|
|
|
A string indicating the name of the event. |
|
|
A reference to the component instance broadcasting the event. |
When an event has additional properties, they are listed in the event's entry in the Components Dictionary.
The event object is automatically generated when an event is triggered and passed to the listener object's callback function or the listener function.
You can use the event object inside the function to access the name of the event that was broadcast, or the instance name of the component that broadcast the event. From the instance name, you can access other component properties. For example, the following code uses the target property of the evtObj event object to access the label property of the myButton instance and sends the value to the Output panel:
var myButton:mx.controls.Button;
var listener:Object;
listener = new Object();
listener.click = function(evtObj){
trace("The " + evtObj.target.label + " button was clicked");
}
myButton.addEventListener("click", listener);
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00002454.html