| Package | com.adobe.cairngorm.control |
| Class | public class CairngormEventDispatcher |
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 : LoginEvent = new LoginEvent();
eventObject.username = username.text;
eventObject.password = username.password;
CairngormEventDispatcher.getInstance().dispatchEvent( eventObject );
See also
| Method | Defined by | ||
|---|---|---|---|
|
CairngormEventDispatcher(target:IEventDispatcher = null)
Constructor.
| CairngormEventDispatcher | ||
|
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Adds an event listener.
| CairngormEventDispatcher | ||
|
dispatchEvent(event:CairngormEvent):Boolean
Dispatches a cairngorm event.
| CairngormEventDispatcher | ||
|
[static]
Returns the single instance of the dispatcher
| CairngormEventDispatcher | ||
|
hasEventListener(type:String):Boolean
Returns whether an event listener exists.
| CairngormEventDispatcher | ||
|
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes an event listener.
| CairngormEventDispatcher | ||
|
willTrigger(type:String):Boolean
Returns whether an event will trigger.
| CairngormEventDispatcher | ||
| CairngormEventDispatcher | () | constructor |
public function CairngormEventDispatcher(target:IEventDispatcher = null)Constructor.
Parameterstarget:IEventDispatcher (default = null) |
| addEventListener | () | method |
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidAdds an event listener.
Parameterstype:String |
|
listener:Function |
|
useCapture:Boolean (default = false) |
|
priority:int (default = 0) |
|
useWeakReference:Boolean (default = false) |
| dispatchEvent | () | method |
public function dispatchEvent(event:CairngormEvent):BooleanDispatches a cairngorm event.
Parametersevent:CairngormEvent |
Boolean |
| getInstance | () | method |
public static function getInstance():CairngormEventDispatcherReturns the single instance of the dispatcher
ReturnsCairngormEventDispatcher |
| hasEventListener | () | method |
public function hasEventListener(type:String):BooleanReturns whether an event listener exists.
Parameterstype:String |
Boolean |
| removeEventListener | () | method |
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):voidRemoves an event listener.
Parameterstype:String |
|
listener:Function |
|
useCapture:Boolean (default = false) |
| willTrigger | () | method |
public function willTrigger(type:String):BooleanReturns whether an event will trigger.
Parameterstype:String |
Boolean |