mx.data

# ItemReference - AS3 ADEP Data Services

Package | mx.data
Class | public dynamic class ItemReference
Inheritance | ItemReference AsyncToken EventDispatcher Object
Implements | IItemReference

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3

Runtime Versions: | Flash Player 9, AIR 1.1

An ItemReference instance is returned from the `DataService.getItem()` and `DataService.createItem()` methods to provide a way to manage a reference to the remote object. The AsyncToken implementation that this class extends provides a list of responders to be notified of result and fault events that occur on the operation to retrieve the item (the get or the create). A binding can be made to the value of the `result` property that always maintains a reference to the managed instance. If the item is deleted in another client, the `result` property will be set to null. If a fault occurs and the DatService instance cannot retrieve the item, the `invalid` property is set to `true`. Listen for the fault event to get more information about what caused the error.

To release the reference to this managed item, call the `ItemReference.releaseItem()` method. This is similar to calling the `DataService.releaseItem()` method however, unlike the `DataService.releaseItem()` this method releases this reference rather than the first item instance found of that type. This occurs when more than one `getItem()` method call to retrieve the same item from different parts of an application is made.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | 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
|  | valid : Boolean Set to false if the ItemReference becomes invalid either because the server faulted when trying to retrieve the item or if the retrieved item was itself null. | ItemReference

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | ItemReference(msg:IMessage) Constructor. | ItemReference
|  | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. | EventDispatcher
|  | addResponder(responder:IResponder):void Adds a responder to an Array of responders. | AsyncToken
|  | dispatchEvent(event:Event):Boolean Dispatches an event into the event flow. | EventDispatcher
|  | hasEventListener(type:String):Boolean Checks whether the EventDispatcher object has any listeners registered for a specific type of event. | EventDispatcher
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | hasResponder():Boolean Determines if this token has at least one mx.rpc.IResponder registered. | AsyncToken
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | releaseItem(copyStillManagedItems:Boolean = true, enableStillManagedCheck:Boolean = true):void Releases the managed item reference retrieved with the getItem() or createItem() method call that returned this ItemReference. | ItemReference
|  | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void Removes a listener from the EventDispatcher object. | EventDispatcher
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object
|  | 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. | EventDispatcher

Events
Click for more information on events
Hide Inherited Events
Show Inherited Events

| Event | Summary | Defined By
--- | --- | --- | ---
|  | activate | [broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher
|  | deactivate | [broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher
|  | propertyChange | Dispatched when a property of the channel set changes. | AsyncToken

Property Detail

### valid

property

`valid:Boolean`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3

Runtime Versions: | Flash Player 9, AIR 1.1

Set to `false` if the ItemReference becomes invalid either because the server faulted when trying to retrieve the item or if the retrieved item was itself null. This property can be used to bind to your user interface controls to display status information for this item without having to listen for explicit fault events.

This property can be used as the source for data binding. When this property is modified, it dispatches the `propertyChange` event.

Implementation
`public function get valid():Boolean`
`public function set valid(value:Boolean):void`
Constructor Detail

### ItemReference

()
Constructor

`public function ItemReference(msg:IMessage)`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3

Runtime Versions: | Flash Player 9, AIR 1.1

Constructor.

Parameters

| `msg:IMessage` — A message object.

Method Detail

### releaseItem

()
method

`public function releaseItem(copyStillManagedItems:Boolean = true, enableStillManagedCheck:Boolean = true):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3

Runtime Versions: | Flash Player 9, AIR 1.1

Releases the managed item reference retrieved with the `getItem()` or `createItem()` method call that returned this ItemReference. It is possible to have more than one ItemReference that points to the same item on the same client. Use this method to release the proper reference.

Parameters

| `copyStillManagedItems:Boolean` (default = `true`)`` — Boolean indicating that a copy of this item should be placed in this ItemReference should the current item still be referenced. This can occur if more than one call to `DataService.getItem()` for this same item is made, or if this item is referenced by a collection returned from a call to `DataService.fill()`.
| `enableStillManagedCheck:Boolean` (default = `true`)`` — Boolean indicating if the item should be checked for additional references.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00