Package | com.asfusion.mate.responses |
Class | public class ResponseHandler |
Implements | flash.events.IEventDispatcher, IResponseHandler |
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.
<mate:Dispatcher> <mate:ResponseHandler type="searchCustomerResult" response="onSearchResultReceived(event.result)" /> </mate:Dispatcher>
Property | Defined 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 |
Property | Defined 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 |
Method | Defined 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 |
Method | Defined by | ||
---|---|---|---|
response(internalEvent:InternalResponseEvent):void
This function is executed when a response is received.
| ResponseHandler |
Event | Summary | Defined by | ||
---|---|---|---|---|
The event that gets dispatched when a response of the type
specified in the type attribute is dispatched. | ResponseHandler |
method | property |
method:Function
[read-write]Function to be executed when a response is back.
The function needs to accept an event:
function myFunction(event:myEventType)
public function get method():Function
public function set method(value:Function):void
MXMLFunction | property |
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.
owner | property |
protected var owner:Dispatcher
Dispatcher
that contains this tag
type | property |
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
public function get type():String
public function set type(value:String):void
See also
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.
ParameterseventType: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.
Parameterstype: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.
Parametersevent:Event |
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.
type:String |
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.
ParameterseventType: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.
Parameterstype: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
ParametersinternalEvent: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.
type:String |
Boolean |
response | event |
*
The event that gets dispatched when a response of the type
specified in the type
attribute is dispatched.