Packagesystem.broadcasters
Classpublic class MessageBroadcaster
InheritanceMessageBroadcaster Inheritance InternalBroadcaster Inheritance Object

This class provides a Broadcaster to dispatch basic message, this broadcaster use a basic "Observer" implementation (like ASBroadcaster in AS1).

Example :

     package examples 
     {
         import system.events.MessageBroadcaster;
         import flash.display.Sprite;
         
         [SWF(width="740", height="480", frameRate="24", backgroundColor="#666666")]
         
         public class MessageBroadcasterExample extends Sprite
         {
             public function MessageBroadcasterExample()
             {
                 var broadcaster:MessageBroadcaster = new MessageBroadcaster() ;
                 broadcaster.addListener( this ) ;
                 broadcaster.broadcastMessage( "message" , "hello" , "world" ) ;
             }
             
             public function message( ...arguments:Array ):void
             {
                 trace( "message : " + arguments ) ;
             }
         }
     }
     



Public Properties
 PropertyDefined By
 Inheritedlength : uint
[read-only] Indicates the number of listeners registered in the Broadcaster.
InternalBroadcaster
Protected Properties
 PropertyDefined By
 Inheritedlisteners : Vector.<BroadcasterEntry>
The Vector representation of all listeners.
InternalBroadcaster
Public Methods
 MethodDefined By
  
MessageBroadcaster(listeners:Array = null)
Creates a new MessageBroadcaster instance.
MessageBroadcaster
 Inherited
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.
MessageBroadcaster
 Inherited
hasListener(listener:*):Boolean
Returns true if this dispatcher contains the specified listener.
InternalBroadcaster
 Inherited
isEmpty():Boolean
Returns true if the set of listeners is empty.
InternalBroadcaster
 Inherited
removeListener(listener:* = null):Boolean
Removes the specified listener or all listeners if the parameter is null.
InternalBroadcaster
 Inherited
toArray():Array
Returns the Array representation of all listeners.
InternalBroadcaster
Constructor Detail
MessageBroadcaster()Constructor
public function MessageBroadcaster(listeners:Array = null)

Creates a new MessageBroadcaster instance.

Parameters
listeners:Array (default = null) — The Array collection of listeners to register in the dispatcher.
Method Detail
broadcastMessage()method
override public function broadcastMessage(message:String, ... rest):*

Broadcast the specified message.

Parameters

message:String
 
... rest

Returns
* — The reference of the Event dispatched by the dispatcher.