Packagegs.util
Classpublic class EventBroadcaster

The EventBroadcaster is a static class, and wraps an instance of an event dispatcher.

Using this class is not recommended, as it leads to spaghetti events - but is here for those who feel the need.

This class really should only be used when you need swf to swf communication, without needing a reference to a swf.


Example
Using the EventBroadcaster:
 
  private function onTest(e:Event):void
  {
    trace("event received");
  }
  EventBroadcaster.addEventListener("test",onTest);
  EventBroadcaster.broadcastEvent(new Event("test"));
  



Public Methods
 MethodDefined by
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
[static] Add a listener the the event broadcaster.
EventBroadcaster
  
broadcastEvent(event:Event):void
[static] Broadcast an event.
EventBroadcaster
  
hasEventListener(type:String):Boolean
[static] Check to see if there is a listener of specified type on the broadcaster.
EventBroadcaster
  
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
[static] Remove an event listener from the broadcaster.
EventBroadcaster
  
willTrigger(type:String):Boolean
[static] Test to see if an event will fire of type.
EventBroadcaster
Method detail
addEventListener()method
public static function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void

Add a listener the the event broadcaster.

Parameters
type:String — The type of event listener
 
listener:Function — The callback function when event is fired
 
useCapture:Boolean (default = false) — UseCapture or not.
 
priority:int (default = 0) — Priority of the event.
 
useWeakReference:Boolean (default = false) — Use weak references.
broadcastEvent()method 
public static function broadcastEvent(event:Event):void

Broadcast an event.

Parameters
event:Event — Any Event.
hasEventListener()method 
public static function hasEventListener(type:String):Boolean

Check to see if there is a listener of specified type on the broadcaster.

Parameters
type:String — The event type.

Returns
Boolean
removeEventListener()method 
public static function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void

Remove an event listener from the broadcaster.

Parameters
type:String — The listener type.
 
listener:Function — The callback listening function.
 
useCapture:Boolean (default = false) — UseCapture of not.
willTrigger()method 
public static function willTrigger(type:String):Boolean

Test to see if an event will fire of type.

Parameters
type:String — The event type.

Returns
Boolean