Listeners (Asbroadcaster._Listeners Property) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

_listeners (AsBroadcaster._listeners property)

A list of references to all registered listener objects. This property is intended for internal use,
and is not intended for direct manipulation. Objects are added to and removed from this
array by calls to the
addListener()
You can call this property only from an object that was initialized by using the
AsBroadcaster.initialize()
Availability: ActionScript 1.0; Flash Player 6
Example
The following example shows how to use the
listener objects currently registered to an event broadcaster. The following code works if it is
added to the first full example in the Examples section of the
entry:
trace(someObject._listeners.length); // Output: 2
For advanced users, the following example shows how to use the
all of the listeners registered with an event broadcaster, along with all of the properties of each
listener object. The following example creates two different listener methods for the first
listener object.
var someObject:Object = new Object(); // create broadcast object
var myListener1:Object = new Object(); // create listener object
var myListener2:Object = new Object(); // create listener object
myListener1.someEvent = function() { // create listener method
trace("myListener1 received someEvent");
}
myListener1.anotherEvent = function() { // create another listener method
trace("myListener1 received anotherEvent");
}
myListener2.someEvent = function() { // create listener method
trace("myListener2 received someEvent");
}
AsBroadcaster.initialize(someObject); // make someObject an event
broadcaster
someObject.addListener(myListener1); // register myListener1 as listener
someObject.addListener(myListener2); // register myListener2 as listener
var numListeners:Number = someObject._listeners.length; // get number of
registered listeners
270
ActionScript classes
and
removelistener()
method.
property to ascertain the number of
length
methods.
AsBroadcaster.initialize()
property to list
_listeners

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF