EventMulticaster
SimpleEventMulticaster multicasts an event to all added listeners with
custom arguments. This class does not support consuming events.
Example:
// creates a multicaster for the 'onError' event
var multicaster:SimpleEventMulticaster = new SimpleEventMulticaster("onError");
// adds listeners
multicaster.addListener(new SimpleErrorListener());
multicaster.addListener(new MyErrorListener());
// executes the specified event on all listeners passing the given arguments
multicaster.dispatch(myErrorCode, myException);
public function SimpleEventMulticaster(eventName:String, listeners:Array)
Constructs a new SimpleEventMulticaster instance.
eventName | the name of the event to execute on all added listeners |
listeners | (optional) an array of listeners to populate this broadcaster with |
| IllegalArgumentException | if passed-in eventName is null,
undefined or an empty string
|
public function getEventName(Void):StringReturns the event name set on construction.
the name of the event
public function removeAllListeners(Void):VoidRemoves all added listeners.
removeAllListeners() in org.as2lib.env.event.EventListenerSource
removeAllListeners() in org.as2lib.env.event.SimpleEventListenerSource
public function dispatch():VoidDispatches the event to all added listeners passing the given arguments as parameters to the listeners' event methods.
... | any number of arguments to pass to the listeners' event methods |
| EventExecutionException | if a listener's event method threw an exception |
dispatch() in org.as2lib.env.event.multicaster.EventMulticaster