Package | com.asfusion.mate.responses |
Class | public class ServiceResponseHandler |
Implements | flash.events.IEventDispatcher, IResponseHandler |
ServiceResponseHandler
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.
It is simple way to receive a response generated by a service call. It contains result and fault handlers you can use as you would when receiving a normal service (ie: RemoteObject) result or fault. It also contains a response handler that can be used for any situation.
<mate:Dispatcher> <mate:ServiceResponseHandler result="trace(event.result)" fault="trace(event.fault.faultString)" response="trace(event.data)" /> </mate:Dispatcher>
Property | Defined by | ||
---|---|---|---|
functions : Dictionary
A reference to the functions generated by the container when
inline functions are used in the
result , fault ,
or response events attibute of the tag. | ServiceResponseHandler | ||
owner : Dispatcher
Dispatcher that contains this tag
| ServiceResponseHandler |
Method | Defined by | ||
---|---|---|---|
Constructor
| ServiceResponseHandler | ||
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.
| ServiceResponseHandler | ||
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.
| ServiceResponseHandler | ||
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
| ServiceResponseHandler | ||
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
| ServiceResponseHandler | ||
removeEventListener(eventType:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
| ServiceResponseHandler | ||
removeResponderListener(type:String, dispatcher:IEventDispatcher):void
This method removes the response listener.
| ServiceResponseHandler | ||
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.
| ServiceResponseHandler |
Method | Defined by | ||
---|---|---|---|
response(internalEvent:InternalResponseEvent):void
This function is executed when a response is received.
| ServiceResponseHandler |
Event | Summary | Defined by | ||
---|---|---|---|---|
The event that gets dispatched when a response of the type "fault" is dispatched. | ServiceResponseHandler | |||
The event that gets dispatched when a response of the type "response" is dispatched. | ServiceResponseHandler | |||
The event that gets dispatched when a response of the type "result" is dispatched. | ServiceResponseHandler |
functions | property |
protected var functions:Dictionary
A reference to the functions generated by the container when
inline functions are used in the result
, fault
,
or response
events attibute of the tag.
owner | property |
protected var owner:Dispatcher
Dispatcher
that contains this tag
ServiceResponseHandler | () | constructor |
public function ServiceResponseHandler()
Constructor
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 |
fault | event |
com.asfusion.mate.events.ResponseEvent
The event that gets dispatched when a response of the type "fault" is dispatched.
response | event |
com.asfusion.mate.events.ResponseEvent
The event that gets dispatched when a response of the type "response" is dispatched.
result | event |
com.asfusion.mate.events.ResponseEvent
The event that gets dispatched when a response of the type "result" is dispatched.