The CairngormEventDispatcher class is a singleton class, used by the application developer to broadcast events that correspond to user gestures and requests.
The singleton implementation of the CairngormEventDispatcher ensures that one and only one class can be responsible for broadcasting events that the FrontController is subscribed to listen and react to.
Since the CairngormEventDispatcher implements singleton access, use of the singleton is simple to distribute throughout your application. At any point in your application, should you capture a user gesture (such as in a click handler, or a dragComplete handler, etc) then simply use a code idiom as follows:
// LoginEvent inherits from com.adobe.cairngorm.control.CairngormEvent
var eventObject = new LoginEvent();
eventObject.username = username.text;
eventObject.password = username.password;
CairngormEventDispatcher.getInstance().dispatchEvent(eventObject);
See also:
openfl.events.IEventDispatcher
Static methods
staticreleaseInstance():Void
Releases the current instance so that the next call to getInstance()
returns a new instance.
Constructor
Methods
addEventListener<T>(type:EventType<T>, listener:T ‑> Void, useCapture:Bool = false, priority:Int = 0, useWeakReference:Bool = false):Void
Adds an event listener.
removeEventListener<T>(type:EventType<T>, listener:T ‑> Void, useCapture:Bool = false):Void
Removes an event listener.