| Package | mx.utils |
| Class | public dynamic class ObjectProxy |
| Inheritance | ObjectProxy Proxy Object |
| Implements | IExternalizable, IPropertyChangeNotifier |
addEventListener() method.
import mx.events.PropertyChangeEvent;
import mx.utils.ObjectUtil;
import mx.utils.ObjectProxy;
import mx.utils.StringUtil;
var a:Object = { name: "Tyler", age: 5, ssnum: "555-55-5555" };
var p:ObjectProxy = new ObjectProxy(a);
p.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, updateHandler);
p.name = "Jacey";
p.age = 2;
delete p.ssnum;
// handler function
function updateHandler(event:ChangeEvent):void
{
trace(StringUtil.substitute("updateHandler('{0}', {1}, {2}, {3}, '{4}')",
event.kind,
event.property,
event.oldValue,
event.newValue,
event.target.object_proxy::UUID));
}
// trace output
updateHandler('opUpdate', name, Jacey, '698AF8CB-B3D9-21A3-1AFFDGHT89075CD2')
updateHandler('opUpdate', age, 2, '698AF8CB-B3D9-21A3-1AFFDGHT89075CD2')
updateHandler('opDelete', ssnum, null, '698AF8CB-B3D9-21A3-1AFFDGHT89075CD2')
| Property | Defined by | ||
|---|---|---|---|
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance.
| Object | |
![]() | prototype : Object
[static]
A reference to the prototype object of a class or function object.
| Object | |
| uid : String
The unique identifier for this object.
| ObjectProxy | ||
| Property | Defined by | ||
|---|---|---|---|
| dispatcher : EventDispatcher
A reference to the EventDispatcher for this proxy.
| ObjectProxy | ||
| notifiers : Object
A hashmap of property change notifiers that this proxy is
listening for changes from; the key of the map is the property name.
| ObjectProxy | ||
| object : Object
[read-only]
The object being proxied.
| ObjectProxy | ||
| propertyList : Array
Contains a list of all of the property names for the proxied object.
| ObjectProxy | ||
| proxyClass : Class
Indicates what kind of proxy to create
when proxying complex properties.
| ObjectProxy | ||
| Method | Defined by | ||
|---|---|---|---|
|
Initializes this proxy with the specified object, id and proxy depth.
| ObjectProxy | ||
|
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object
so that the listener receives notification of an event.
| ObjectProxy | ||
|
Dispatches an event into the event flow.
| ObjectProxy | ||
|
Checks whether there are any event listeners registered
for a specific type of event.
| ObjectProxy | ||
![]() |
Indicates whether an object has a specified property defined.
| Object | |
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter.
| Object | |
|
Called when a complex property is updated.
| ObjectProxy | ||
![]() |
Indicates whether the specified property exists and is enumerable.
| Object | |
|
Since Flex only uses ObjectProxy to wrap anonymous objects,
the server flex.messaging.io.ObjectProxy instance serializes itself
as a Map that will be returned as a plain ActionScript object.
| ObjectProxy | ||
|
Removes an event listener.
| ObjectProxy | ||
![]() |
Sets the availability of a dynamic property for loop operations.
| Object | |
![]() |
Returns the string representation of the specified object.
| Object | |
![]() |
Returns the primitive value of the specified object.
| Object | |
|
Checks whether an event listener is registered with this object
or any of its ancestors for the specified event type.
| ObjectProxy | ||
|
Since Flex only serializes the inner ActionScript object that it wraps,
the server flex.messaging.io.ObjectProxy populates itself
with this anonymous object's contents and appears to the user as a Map.
| ObjectProxy | ||
| Method | Defined by | ||
|---|---|---|---|
|
Returns the value of the proxied object's method with the specified name.
| ObjectProxy | ||
|
Deletes the specified property on the proxied object and
sends notification of the delete to the handler.
| ObjectProxy | ||
|
Provides a place for subclasses to override how a complex property that
needs to be either proxied or daisy chained for event bubbling is managed.
| ObjectProxy | ||
![]() |
Overrides the use of the
descendant operator. | Proxy | |
|
Returns the specified property value of the proxied object.
| ObjectProxy | ||
|
This is an internal function that must be implemented by
a subclass of flash.utils.Proxy.
| ObjectProxy | ||
![]() |
Checks whether a supplied QName is also marked as an attribute.
| Proxy | |
|
This is an internal function that must be implemented by
a subclass of flash.utils.Proxy.
| ObjectProxy | ||
|
This is an internal function that must be implemented by
a subclass of flash.utils.Proxy.
| ObjectProxy | ||
|
This is an internal function that must be implemented by
a subclass of flash.utils.Proxy.
| ObjectProxy | ||
|
Updates the specified property on the proxied object
and sends notification of the update to the handler.
| ObjectProxy | ||
|
This method creates an array of all of the property names for the
proxied object.
| ObjectProxy | ||
| dispatcher | property |
protected var dispatcher:EventDispatcherA reference to the EventDispatcher for this proxy.
| notifiers | property |
protected var notifiers:ObjectA hashmap of property change notifiers that this proxy is listening for changes from; the key of the map is the property name.
| object | property |
object:Object [read-only]The object being proxied.
This property can be used as the source for data binding.
Implementation object_proxy function get object():Object
| propertyList | property |
protected var propertyList:Array
Contains a list of all of the property names for the proxied object.
Descendants need to fill this list by overriding the
setupPropertyList() method.
| proxyClass | property |
protected var proxyClass:ClassIndicates what kind of proxy to create when proxying complex properties. Subclasses should assign this value appropriately.
| uid | property |
uid:String [read-write]The unique identifier for this object.
This property can be used as the source for data binding.
Implementation public function get uid():String
public function set uid(value:String):void
| ObjectProxy | () | constructor |
public function ObjectProxy(item:Object = null, uid:String = null, proxyDepth:int = -1)Initializes this proxy with the specified object, id and proxy depth.
Parametersitem:Object (default = null) — Object to proxy.
If no item is specified, an anonymous object will be constructed
and assigned.
|
|
uid:String (default = null) — String containing the unique id
for this object instance.
Required for IPropertyChangeNotifier compliance as every object must
provide a unique way of identifying it.
If no value is specified, a random id will be assigned.
|
|
proxyDepth:int (default = -1) — An integer indicating how many levels in a complex
object graph should have a proxy created during property access.
The default is -1, meaning "proxy to infinite depth".
|
import mx.events.PropertyChangeEvent;
import mx.utils.ObjectUtil;
import mx.utils.ObjectProxy;
import mx.utils.StringUtil;
var a:Object = { name: "Tyler", age: 5, ssnum: "555-55-5555" };
var p:ObjectProxy = new ObjectProxy(a);
p.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, updateHandler);
p.name = "Jacey";
p.age = 2;
delete p.ssnum;
// handler function
function updateHandler(event:PropertyChangeEvent):void
{
trace(StringUtil.substitute("updateHandler('{0}', {1}, {2}, {3}, '{4}')",
event.kind,
event.property,
event.oldValue,
event.newValue,
event.target.uid));
}
// trace output
updateHandler('opUpdate', name, Jacey, '698AF8CB-B3D9-21A3-1AFFDGHT89075CD2')
updateHandler('opUpdate', age, 2, '698AF8CB-B3D9-21A3-1AFFDGHT89075CD2')
updateHandler('opDelete', ssnum, null, '698AF8CB-B3D9-21A3-1AFFDGHT89075CD2')
| addEventListener | () | method |
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidRegisters an event listener object so that the listener receives notification of an event. For more information, see the flash.events.EventDispatcher class.
Parameterstype:String |
|
listener:Function |
|
useCapture:Boolean (default = false) |
|
priority:int (default = 0) |
|
useWeakReference:Boolean (default = false) |
See also
| callProperty | () | method |
flash_proxy override function callProperty(name:*, ... rest):*Returns the value of the proxied object's method with the specified name.
Parametersname:* — The name of the method being invoked.
|
|
... rest — An array specifying the arguments to the
called method.
|
* — The return value of the called method.
|
| deleteProperty | () | method |
flash_proxy override function deleteProperty(name:*):BooleanDeletes the specified property on the proxied object and sends notification of the delete to the handler.
Parametersname:* — Typically a string containing the name of the property,
or possibly a QName where the property name is found by
inspecting the localName property.
|
Boolean —
A Boolean indicating if the property was deleted.
|
| dispatchEvent | () | method |
public function dispatchEvent(event:Event):BooleanDispatches an event into the event flow. For more information, see the flash.events.EventDispatcher class.
Parametersevent:Event |
Boolean |
See also
| getComplexProperty | () | method |
object_proxy function getComplexProperty(name:*, value:*):*Provides a place for subclasses to override how a complex property that needs to be either proxied or daisy chained for event bubbling is managed.
Parametersname:* — Typically a string containing the name of the property,
or possibly a QName where the property name is found by
inspecting the localName property.
|
|
value:* — The property value.
|
* — The property value or an instance of ObjectProxy.
|
| getProperty | () | method |
flash_proxy override function getProperty(name:*):*Returns the specified property value of the proxied object.
Parametersname:* — Typically a string containing the name of the property,
or possibly a QName where the property name is found by
inspecting the localName property.
|
* — The value of the property.
In some instances this value may be an instance of
ObjectProxy.
|
| hasEventListener | () | method |
public function hasEventListener(type:String):BooleanChecks whether there are any event listeners registered for a specific type of event. This allows you to determine where an object has altered handling of an event type in the event flow hierarchy. For more information, see the flash.events.EventDispatcher class.
Parameterstype:String |
Boolean |
See also
| hasProperty | () | method |
flash_proxy override function hasProperty(name:*):BooleanThis is an internal function that must be implemented by a subclass of flash.utils.Proxy.
Parametersname:* — The property name that should be tested
for existence.
|
Boolean |
See also
| nextName | () | method |
flash_proxy override function nextName(index:int):StringThis is an internal function that must be implemented by a subclass of flash.utils.Proxy.
Parametersindex:int |
String |
See also
| nextNameIndex | () | method |
flash_proxy override function nextNameIndex(index:int):intThis is an internal function that must be implemented by a subclass of flash.utils.Proxy.
Parametersindex:int |
int |
See also
| nextValue | () | method |
flash_proxy override function nextValue(index:int):*This is an internal function that must be implemented by a subclass of flash.utils.Proxy.
Parametersindex:int |
* |
See also
| propertyChangeHandler | () | method |
public function propertyChangeHandler(event:PropertyChangeEvent):voidCalled when a complex property is updated.
Parametersevent:PropertyChangeEvent |
| readExternal | () | method |
public function readExternal(input:IDataInput):voidSince Flex only uses ObjectProxy to wrap anonymous objects, the server flex.messaging.io.ObjectProxy instance serializes itself as a Map that will be returned as a plain ActionScript object. Yo can then set the object_proxy object property to this value.
Parametersinput:IDataInput |
| removeEventListener | () | method |
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):voidRemoves an event listener. If there is no matching listener registered with the EventDispatcher object, a call to this method has no effect. For more information, see the flash.events.EventDispatcher class.
Parameterstype:String |
|
listener:Function |
|
useCapture:Boolean (default = false) |
See also
| setProperty | () | method |
flash_proxy override function setProperty(name:*, value:*):voidUpdates the specified property on the proxied object and sends notification of the update to the handler.
Parametersname:* — Object containing the name of the property that
should be updated on the proxied object.
|
|
value:* — Value that should be set on the proxied object.
|
| setupPropertyList | () | method |
protected function setupPropertyList():void
This method creates an array of all of the property names for the
proxied object.
Descendants must override this method if they wish to add more
properties to this list.
Be sure to call super.setupPropertyList before making any
changes to the propertyList property.
| willTrigger | () | method |
public function willTrigger(type:String):Boolean
Checks whether an event listener is registered with this 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 object or any of its descendants.
For more information, see the flash.events.EventDispatcher class.
type:String |
Boolean |
See also
| writeExternal | () | method |
public function writeExternal(output:IDataOutput):voidSince Flex only serializes the inner ActionScript object that it wraps, the server flex.messaging.io.ObjectProxy populates itself with this anonymous object's contents and appears to the user as a Map.
Parametersoutput:IDataOutput |
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flex/2/langref/mx/utils/ObjectProxy.html
Comments
No screen name said on Jul 16, 2006 at 3:05 PM : mbd said on Jul 26, 2006 at 7:18 AM :