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:

Static methods

staticgetInstance():CairngormEventDispatcher

Returns the single instance of the dispatcher

staticreleaseInstance():Void

Releases the current instance so that the next call to getInstance() returns a new instance.

Constructor

@:value({ target : null })new(?target:IEventDispatcher)

Constructor.

Methods

@:value({ useWeakReference : false, priority : 0, useCapture : false })addEventListener<T>(type:EventType<T>, listener:T ‑> Void, useCapture:Bool = false, priority:Int = 0, useWeakReference:Bool = false):Void

Adds an event listener.

dispatchEvent(event:CairngormEvent):Bool

Dispatches a cairngorm event.

hasEventListener(type:String):Bool

Returns whether an event listener exists.

@:value({ useCapture : false })removeEventListener<T>(type:EventType<T>, listener:T ‑> Void, useCapture:Bool = false):Void

Removes an event listener.

willTrigger(type:String):Bool

Returns whether an event will trigger.