Flash CS3 Documentation |
|||
| Using ActionScript 2.0 Components > Handling Component Events > Using listeners to handle events | |||
The version 2 component architecture has a broadcaster/listener event model. (A broadcaster is sometimes also referred to as a dispatcher.) It is important to understand the following key points about the model:
addEventListener() method from the broadcaster. Use the following syntax:componentInstance.addEventListener("eventName",listenerObjectORFunction);
myButton.addEventListener("click", listener1);
myButton.addEventListener("click", listener2);
myButton.addEventListener("click", listener1);
myButton2.addEventListener("click", listener1);
You can use the event object in the body of the function to retrieve information about the event type, and the instance that broadcast the event. See About the event object.
myComponent.removeEventListener("change", ListenerObj);
This section contains the following topics:
Flash CS3