![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
An event object is passed to a listener as a parameter. The event object is an ActionScript object that has properties that contain information about the event that occurred. You can use the event object inside the listener callback function to access the name of the event that was broadcast, or the instance name of the component that broadcast the event. For example, the following code uses the target
property of the evtObj
event object to access the label
property of the myButton
instance and send the value to the Output panel:
listener = new Object(); listener.click = function(evtObj){ trace("The " + evtObj.target.label + " button was clicked"); } myButton.addEventListener("click", listener);
Some event object properties are defined in the W3C specification but aren't implemented in version 2 (v2) of the Macromedia Component Architecture. Every v2 event object has the properties listed in the table below. Some events have additional properties defined, and if so, the properties are listed in the event's entry.
Property |
Description |
---|---|
type |
A String indicating the name of the event. |
target |
A reference to the component instance broadcasting the event. |
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |