| Package | system.broadcasters |
| Class | public class FastDispatcher |
| Inheritance | FastDispatcher InternalBroadcaster Object |
Event object to dispatch the message to the listeners.
Example :
package examples
{
import system.events.BasicEvent;
import system.events.FastDispatcher;
import flash.display.Sprite;
import flash.events.Event;
[SWF(width="740", height="480", frameRate="24", backgroundColor="#666666")]
public class FastDispatcherExample extends Sprite
{
public function FastDispatcherExample()
{
var dispatcher:FastDispatcher = new FastDispatcher() ;
dispatcher.addListener( this ) ;
dispatcher.broadcastMessage( "onCallback" ) ;
dispatcher.dispatch( new BasicEvent( "onCallback" ) ) ;
}
public function onCallback( e:Event ):void
{
trace( e ) ;
}
}
}
| Method | Defined By | ||
|---|---|---|---|
FastDispatcher(listeners:Array = null)
Creates a new FastDispatcher instance. | FastDispatcher | ||
![]() | addListener(listener:*, priority:uint = 0, autoRemove:Boolean = false):Boolean
Registers an object to receive messages. | InternalBroadcaster | |
broadcastMessage(message:String, ... rest):* [override]
Broadcast the specified message. | FastDispatcher | ||
dispatch(event:Event):void
Sends an Event Object to each object in the list of listeners. | FastDispatcher | ||
![]() | hasListener(listener:*):Boolean
Returns true if this dispatcher contains the specified listener. | InternalBroadcaster | |
![]() | isEmpty():Boolean
Returns true if the set of listeners is empty. | InternalBroadcaster | |
![]() | removeListener(listener:* = null):Boolean
Removes the specified listener or all listeners if the parameter is null. | InternalBroadcaster | |
![]() | toArray():Array
Returns the Array representation of all listeners. | InternalBroadcaster | |
| FastDispatcher | () | Constructor |
public function FastDispatcher(listeners:Array = null)Creates a new FastDispatcher instance.
Parameterslisteners:Array (default = null) — The Array collection of listeners to register in the dispatcher.
|
| broadcastMessage | () | method |
override public function broadcastMessage(message:String, ... rest):*Broadcast the specified message.
Parameters
message:String — The message to broadcast.
| |
... rest — Optional parameters passed in with the broadcast message.
|
* |
| dispatch | () | method |
public function dispatch(event:Event):voidSends an Event Object to each object in the list of listeners. When the Event is received by the listening object, Flash Player attempts to invoke a function of the same name on the Event.type property.
Parameters
event:Event |