ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > AsBroadcaster > removeListener (AsBroadcaster.removeListener method) | |||
public removeListener(listenerObj:Object) : Boolean
Removes an object from the list of objects that receive event notification messages.
You can call this method only from an object that has been initialized by using the AsBroadcaster.initialize() method.
Availability: ActionScript 1.0; Flash Player 6
listenerObj:Object - The name of a listener object that is registered to receive event notification from the broadcasting object.
Boolean - Returns true if the listener object is removed, and false otherwise.
The following example shows how to remove a listener from the list of registered listeners. The following code works if it is added to the first full example in the Examples section of the AsBroadcaster.initialize() entry. The trace() statements are included only to verify that the number of registered listeners is reduced by one after calling the removeListener() method.
trace(someObject._listeners.length); // Output: 2 someObject.removeListener(myListener1); trace(someObject._listeners.length); // Output: 1
addListener (AsBroadcaster.addListener method), initialize (AsBroadcaster.initialize method)
|
|
|
|