EventDispatcher.addEventListener()
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004 and Flash MX Professional 2004.
Usage
componentInstance.addEventListener(event, listener)
Parameters
A string that is the name of the event.
event
A reference to a listener object or function.
listener
Returns
Nothing.
Description
Method; registers a listener object with a component instance that is broadcasting an event.
When the event occurs, the listener object or function is notified. You can call this method
from any component instance. For example, the following code registers a listener to the
component instance
:
myButton
myButton.addEventListener("click", myListener);
You must define the listener as either an object or a function before you call
to register the listener with the component instance. If the listener is
addEventListener()
an object, it must have a callback function defined that is invoked when the event occurs.
Usually, that callback function has the same name as the event with which the listener is
registered. If the listener is a function, the function is invoked when the event occurs. For
more information, see "Using listeners to handle events" in Using Components.
EventDispatcher.addEventListener()
501
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?