Apache Flex 4.16.1 API Reference | All Packages | All Classes | Index | Frames No Frames |
AsyncToken

Package | mx.rpc
Class | public dynamic class AsyncToken
Inheritance | AsyncToken flash.events.EventDispatcher

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

This class provides a place to set additional or token-level data for asynchronous RPC operations. It also allows an IResponder to be attached for an individual call. The AsyncToken can be referenced in `ResultEvent` and `FaultEvent` from the `token` property.

Public Properties

| Property | Defined By
--- | --- | ---
|  | message : IMessage [read-only] Provides access to the associated message. | AsyncToken
|  | responders : Array [read-only] An array of IResponder handlers that will be called when the asynchronous request completes. | AsyncToken
|  | result : Object [read-only] The result that was returned by the associated RPC call. | AsyncToken

Public Methods

| Method | Defined By
--- | --- | ---
|  | AsyncToken(message:IMessage = null) Constructs an instance of the token with the specified message. | AsyncToken
|  | addResponder(responder:IResponder):void Adds a responder to an Array of responders. | AsyncToken
|  | hasResponder():Boolean Determines if this token has at least one mx.rpc.IResponder registered. | AsyncToken

Events

| Event | Summary | Defined By
--- | --- | --- | ---
|  | propertyChange | Dispatched when a property of the channel set changes. | AsyncToken

Property Detail

message | property

`message:IMessage` [read-only]

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Provides access to the associated message.

Implementation
`public function get message():IMessage`

responders | property |

`responders:Array` [read-only]

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

An array of IResponder handlers that will be called when the asynchronous request completes. Eaxh responder assigned to the token will have its `result` or `fault` function called passing in the matching event before the operation or service dispatches the event itself. A developer can prevent the service from subsequently dispatching the event by calling `event.preventDefault()`. Note that this will not prevent the service or operation's `result` property from being assigned.

Implementation
`public function get responders():Array`

result | property |

`result:Object` [read-only]

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

The result that was returned by the associated RPC call. Once the result property on the token has been assigned it will be strictly equal to the result property on the associated ResultEvent.

This property can be used as the source for data binding.

Implementation
`public function get result():Object`
Constructor Detail

AsyncToken | () | Constructor

`public function AsyncToken(message:IMessage = null)`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Constructs an instance of the token with the specified message.

Parameters

| `message:IMessage` (default = `null`)`` — The message with which the token is associated.

Method Detail

addResponder | () | method

`public function addResponder(responder:IResponder):void`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Adds a responder to an Array of responders. The object assigned to the responder parameter must implement `mx.rpc.IResponder`.

Parameters

| `responder:IResponder` — A handler which will be called when the asynchronous request completes.

See also

mx.rpc.IResponder

hasResponder | () | method |

`public function hasResponder():Boolean`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Determines if this token has at least one `mx.rpc.IResponder` registered.

Returns

| `Boolean` — true if at least one responder has been added to this token.

Event Detail

propertyChange | Event

Event Object Type: `mx.events.PropertyChangeEvent`
PropertyChangeEvent.type property = `mx.events.PropertyChangeEvent.PROPERTY_CHANGE`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Dispatched when a property of the channel set changes.

The `PropertyChangeEvent.PROPERTY_CHANGE` constant defines the value of the `type` property of the event object for a `PropertyChange` event.

The properties of the event object have the following values:

Property | Value
--- | ---
`bubbles` | Determined by the constructor; defaults to false.
`cancelable` | Determined by the constructor; defaults to false.
`kind` | The kind of change; PropertyChangeEventKind.UPDATE or PropertyChangeEventKind.DELETE.
`oldValue` | The original property value.
`newValue` | The new property value, if any.
`property` | The property that changed.
`source` | The object that contains the property that changed.
`currentTarget` | The Object that defines the event listener that handles the event. For example, if you use `myButton.addEventListener()` to register an event listener, myButton is the value of the `currentTarget`.
`target` | The Object that dispatched the event; it is not always the Object listening for the event. Use the `currentTarget` property to always access the Object listening for the event.

Wed Nov 15 2017, 09:50 AM +01:00