Package | gs.util |
Class | public class EventBroadcaster |
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.
private function onTest(e:Event):void { trace("event received"); } EventBroadcaster.addEventListener("test",onTest); EventBroadcaster.broadcastEvent(new Event("test"));
Method | Defined 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 |
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.
Parameterstype: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.
Parametersevent: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.
Parameterstype:String — The event type.
|
Boolean |
removeEventListener | () | method |
public static function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Remove an event listener from the broadcaster.
Parameterstype: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.
Parameterstype:String — The event type.
|
Boolean |