Packagecom.asfusion.mate.responses
Classpublic class ResponseHandler
Implementsflash.events.IEventDispatcher, IResponseHandler

The ResponseHandler tag can be used to receive a response from an event that was dispatched from a Dispatcher instance.

After dispatching an event using the Dispatcher tag, the view that dispatched this event can receive a response.

Those responses are sent from the EventMap within the EventHandlers that was listening for the event dispatched by the Dispatcher.

It's important to note that this response will be received only by the view instance that dispatched the event, even if there are other instances of the same view or other views dispatch the same event.


Example
  <mate:Dispatcher>
       <mate:ResponseHandler type="searchCustomerResult" response="onSearchResultReceived(event.result)" />
  </mate:Dispatcher>
  



Public Properties
 PropertyDefined by
  method : Function
Function to be executed when a response is back.
ResponseHandler
  type : String
Type of the event that this ReponseHandler is listening to.
ResponseHandler
Protected Properties
 PropertyDefined by
  MXMLFunction : Function
A reference to the function generated by the container when an inline function is used in the response event attibute of the tag.
ResponseHandler
  owner : Dispatcher
Dispatcher that contains this tag
ResponseHandler
Public Methods
 MethodDefined by
  
addEventListener(eventType:String, listener:Function, useCapture:Boolean = false, priority:int = 0.0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
ResponseHandler
  
addReponderListener(type:String, dispatcher:IEventDispatcher, owner:Dispatcher):void
This method receives an eventDispatcher to register as a listener for a response for a specific event.
ResponseHandler
  
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
ResponseHandler
  
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
ResponseHandler
  
removeEventListener(eventType:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
ResponseHandler
  
removeResponderListener(type:String, dispatcher:IEventDispatcher):void
This method removes the response listener.
ResponseHandler
  
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
ResponseHandler
Protected Methods
 MethodDefined by
  
response(internalEvent:InternalResponseEvent):void
This function is executed when a response is received.
ResponseHandler
Events
 EventSummaryDefined by
   The event that gets dispatched when a response of the type specified in the type attribute is dispatched.ResponseHandler
Property detail
methodproperty
method:Function  [read-write]

Function to be executed when a response is back.

The function needs to accept an event:
function myFunction(event:myEventType)

Implementation
    public function get method():Function
    public function set method(value:Function):void
MXMLFunctionproperty 
protected var MXMLFunction:Function

A reference to the function generated by the container when an inline function is used in the response event attibute of the tag.

ownerproperty 
protected var owner:Dispatcher

Dispatcher that contains this tag

typeproperty 
type:String  [read-write]

Type of the event that this ReponseHandler is listening to. This type needs to match the ResponseAnnouncer type defined in the IActionList in the EventMap

Implementation
    public function get type():String
    public function set type(value:String):void

See also

com.asfusion.mate.actions.builders.ReponseAnnouncer
Method detail
addEventListener()method
public function addEventListener(eventType:String, listener:Function, useCapture:Boolean = false, priority:int = 0.0, useWeakReference:Boolean = false):void

Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. You can register event listeners on all nodes in the display list for a specific type of event, phase, and priority.

Parameters
eventType:String
 
listener:Function
 
useCapture:Boolean (default = false)
 
priority:int (default = 0.0)
 
useWeakReference:Boolean (default = false)
addReponderListener()method 
public function addReponderListener(type:String, dispatcher:IEventDispatcher, owner:Dispatcher):void

This method receives an eventDispatcher to register as a listener for a response for a specific event. It is called by the Dispatcher before the event gets dispatched.

Parameters
type:String
 
dispatcher:IEventDispatcher
 
owner:Dispatcher
dispatchEvent()method 
public function dispatchEvent(event:Event):Boolean

Dispatches an event into the event flow. The event target is the EventDispatcher object upon which dispatchEvent() is called.

Parameters
event:Event

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

Checks whether the EventDispatcher object has any listeners registered for a specific type of event. This allows you to determine where an EventDispatcher object has altered handling of an event type in the event flow hierarchy. To determine whether a specific event type will actually trigger an event listener, use IEventDispatcher.willTrigger().

The difference between hasEventListener() and willTrigger() is that hasEventListener() examines only the object to which it belongs, whereas willTrigger() examines the entire event flow for the event specified by the type parameter.

Parameters
type:String

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

Removes a listener from the EventDispatcher object. If there is no matching listener registered with the EventDispatcher object, a call to this method has no effect.

Parameters
eventType:String
 
listener:Function
 
useCapture:Boolean (default = false)
removeResponderListener()method 
public function removeResponderListener(type:String, dispatcher:IEventDispatcher):void

This method removes the response listener. It is called by the Dispatcher after the response is back.

Parameters
type:String
 
dispatcher:IEventDispatcher
response()method 
protected function response(internalEvent:InternalResponseEvent):void

This function is executed when a response is received. It gets an internalEvent that contains the real event that was dispatched

Parameters
internalEvent:InternalResponseEvent
willTrigger()method 
public function willTrigger(type:String):Boolean

Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. This method returns true if an event listener is triggered during any phase of the event flow when an event of the specified type is dispatched to this EventDispatcher object or any of its descendants.

The difference between hasEventListener() and willTrigger() is that hasEventListener() examines only the object to which it belongs, whereas willTrigger() examines the entire event flow for the event specified by the type parameter.

Parameters
type:String

Returns
Boolean
Event detail
responseevent 
Event object type: *

The event that gets dispatched when a response of the type specified in the type attribute is dispatched.