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

Parameters

listenerObj:Object - The name of a listener object that is registered to receive event notification from the broadcasting object.

Returns

Boolean - Returns true if the listener object is removed, and false otherwise.

Example

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

See also

addListener (AsBroadcaster.addListener method), initialize (AsBroadcaster.initialize method)