Wednesday, January 28, 2009

Accessing proxied object

When receiving objects back from a server, they are usually wrapped up as a ObjectProxy. I wanted to know how I could access the protected object property on the ObjectProxy, so here's how you do it:
import mx.utils.ObjectProxy;
import mx.utils.object_proxy;
import mx.rpc.events.ResultEvent;

private function resultHandler(event:ResultEvent):void {
    var proxy:ObjecyProxy = ObjectProxy(event.result);
    var obj:Object = proxy.object_proxy::object;
}

I found the solution from this useful website:
http://www.docsultant.com/site2/articles/flex_internals.html

No comments: