ListenerArray
| Kind of class: | class |
|---|---|
| Inherits from: | Array |
| Version: | 1.0 |
| Author: | Francis Bourre |
| Classpath: | com.bourre.events.ListenerArray |
| File last modified: | Wednesday, 31 October 2007, 07:35:29 |
ListenerArray defines data structure, based on Array, to store listeners list used by IeventDispatcher instances.
See EventBroadcaster for ListenerArray example.
Summary
Constructor
Constructor
ListenerArray
function ListenerArray (
)
Constructs a new
ListenerArray instance.Can use Array instanciation way to build a new
ListenerArray'one like :
var a : new ListenerArray( myListenerArray1, myListenerArray2, ...);
Example
var a : ListenerArray = new ListenerArray();
See also:
Instance methods
getIndex
function getIndex (
) : Number
Returns index
Number of passed-in oL listener.Example
var oEB : EventBroadcaster = new EventBroadcaster( this ); oEB.addListener( myListener ); var n : Number = a.getIndex( myListener );
Parameters:
oL:
Listener to check.
Returns:
Number index of listener or -1 if listener not exist.insert
function insert (
) : Boolean
Adds passed-in
oL listener into structure.Internally used by IEventDispatcher to register new listeners.
Example
a.push( myListener );
Parameters:
oL:
Listener to add.
Returns:
(if already exist)
true if listener has been successfully added, either false (if already exist)
isEmpty
function isEmpty (
) : Boolean
Indicates if strucutre is empty.
Example
var b : Boolean = a.isEmpty( myListener );
Returns:
true if structure contains no listeners, either falselistenerExists
function listenerExists (
) : Boolean
Indicates if passed-in
oL listener is referenced in structure.Example
var b : Boolean = a.listenerExists( myListener ); //return true
Parameters:
oL:
Listener to check.
Returns:
true is listener exist, either falseremove
function remove (
) : Boolean
Removes passed-in
oL listener from structure.Internally used by IEventDispatcher to unsubscribe listeners.
Example
a.remove( myListener );
Parameters:
oL:
Listener to remove.
Returns:
true if listener has been found and removed, either falsetoString
function toString (
) : String
Returns the string representation of this instance.
Returns:
the string representation of this instance