Packagecom.adobe.cairngorm.control
Classpublic class CairngormEventDispatcher

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 : LoginEvent = new LoginEvent();
    eventObject.username = username.text;
    eventObject.password = username.password;
    
    CairngormEventDispatcher.getInstance().dispatchEvent( eventObject );
    

See also

com.adobe.cairngorm.control.FrontController
com.adobe.cairngorm.control.CairngormEvent
flash.events.IEventDispatcher


Public Methods
 MethodDefined 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
  
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
Constructor detail
CairngormEventDispatcher()constructor
public function CairngormEventDispatcher(target:IEventDispatcher = null)

Constructor.

Parameters
target:IEventDispatcher (default = null)
Method detail
addEventListener()method
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void

Adds an event listener.

Parameters
type:String
 
listener:Function
 
useCapture:Boolean (default = false)
 
priority:int (default = 0)
 
useWeakReference:Boolean (default = false)
dispatchEvent()method 
public function dispatchEvent(event:CairngormEvent):Boolean

Dispatches a cairngorm event.

Parameters
event:CairngormEvent

Returns
Boolean
getInstance()method 
public static function getInstance():CairngormEventDispatcher

Returns the single instance of the dispatcher

Returns
CairngormEventDispatcher
hasEventListener()method 
public function hasEventListener(type:String):Boolean

Returns whether an event listener exists.

Parameters
type:String

Returns
Boolean
removeEventListener()method 
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void

Removes an event listener.

Parameters
type:String
 
listener:Function
 
useCapture:Boolean (default = false)
willTrigger()method 
public function willTrigger(type:String):Boolean

Returns whether an event will trigger.

Parameters
type:String

Returns
Boolean