Hi, I have a problem on the ObjectProxy object. I saw a lot of posts which talk about Objectproxy, but they don't help me to solve my problem.
I develop using Flex/actionScript and grails. I d'like retrieve MyObject after a service call (get()) Here is my code : main.mxml <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="1024" height="720" alpha="1.0" backgroundColor="#7CA9C9" backgroundAlpha="0.8" themeColor="#E1EEF1" borderColor="#256CA3" cornerRadius="0" borderStyle="outset" backgroundGradientAlphas="[0.78, 0.27]" backgroundGradientColors="[#339BD6, #E3EDF4]"> <mx:RemoteObject id="myservice" fault="faultHandler(event)" destination="MyGrailsService"> <mx:method name="get" result="resultGetHandler(event)"/> </mx:RemoteObject> <mx:Script> <![CDATA[ import flash.events.*; import mx.managers.CursorManager; import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; import MyObject; [Bindable] public var myObject:MyObject; private function faultHandler(fault:FaultEvent):void { outputError.text = "Erreur lors de l'appel au service" + "code:n" + fault.fault.faultCode + "nnMessage:n" + fault.fault.faultString + "nnDetail:n" + fault.fault.faultDetail; } private function resultGetHandler(evt:ResultEvent):void { //THE PROBLEM IS HERE myObject= new MyObject(); myObject= evt.result.object as MyObject; //THE PROBLEM IS HERE if(myObject != null) { if(myObject is MyObject) { output2.text = myObject.libelle + " -" ; } else{ output2.text = "OBJET isn't a MyObject"; } } else { output2.text = "RESULT NULL"; } } ]]> </mx:Script> <mx:TextArea x="380" y="50" width="309" height="69" id="output2" initialize="myservice.get(9)" wordWrap="true" color="#E83C0E" themeColor="#24C637" backgroundAlpha="0.41" alpha="0.87" enabled="true" editable="true" fontWeight="bold" fontFamily="Arial" borderStyle="none" fontSize="18"/> </mx:Application> MyObject.as package { import mx.collections.ArrayCollection; [Bindable] [RemoteClass(alias="MyObject")] public class MyObject { public function MyObject() { } public var designation:String; public var myObject:MyObject; public var myObjects:ArrayCollection; } } execute If I execute the application in debug mode, I get myObject equal to null whereas myObject is well created with the new I have also tried "myObject= evt.result.valueOf() as MyObject;" but it doesn't work. Can someone help me please ? Thanks for your answer ! Xavier -- View this message in context: http://www.nabble.com/Objectproxy-cast-in-MyObject-tp16416885p16416885.html Sent from the FlexCoders mailing list archive at Nabble.com.

