(Adobe® Flex™ Data Services 2 only)
Packagemx.data
Classpublic dynamic class ItemReference
InheritanceItemReference Inheritance AsyncToken Inheritance EventDispatcher Inheritance Object

An ItemReference instance is returned from the DataService.getItem() and DataService.createItem() methods to provide you with a way to manage your 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). You can bind 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 is 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.

When you want to release your reference to this managed item, you should call the ItemReference.releaseItem() method. This is similar to calling the DataService.releaseItem() method but if you are holding references to the ItemReference instance you should use this version of the releaseItem() method to ensure that you release the correct reference to the item in case you have made more than one getItem() method call to retrieve the same item from different parts of your application.



Public Properties
 PropertyDefined by
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedmessage : IMessage
Provides access to the associated message.
AsyncToken
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
 Inheritedresponders : Array
An array of IResponder handlers that will be called when the asynchronous request completes.
AsyncToken
 Inheritedresult : Object
The result that was returned by the associated RPC call.
AsyncToken
  valid : Boolean = false
Set to true 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
  valid : Boolean = false
ItemReference
Public Methods
 MethodDefined by
  
ItemReference
 Inherited
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
 Inherited
addResponder adds a responder to an Array of responders.
AsyncToken
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Determines if this token has at least one mx.rpc.IResponder registered.
AsyncToken
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
  
releaseItem(clear:Boolean = true):void
Releases the managed item reference retrieved with the getItem() or createItem() method call that returned this ItemReference.
ItemReference
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 EventSummaryDefined by
 Inherited Dispatched when a property of the channel set changes.AsyncToken
Property detail
validproperty
public var valid:Boolean = false

Set to true if the ItemReference becomes invalid either because the server faulted when trying to retrieve the item or if the retrieved item was itself null. You can use this property 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.

validproperty 
public var valid:Boolean = false
Constructor detail
ItemReference()constructor
public function ItemReference(msg:IMessage)Parameters
msg:IMessage
Method detail
releaseItem()method
public function releaseItem(clear:Boolean = true):void

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

Parameters
clear:Boolean (default = true)




 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flex/2/langref/mx/data/ItemReference.html