I’m beginner to AS3 and I’m using FlashDevelop as IDE and I’m trying to connect to AMF3 service (amfphp) and get user details.
I can connect to AMF service with this code in AMFinit() function…
private function AMFinit():void{
AMFService.objectEncoding = ObjectEncoding.AMF3;
AMFService.connect(AMFServiceURL);
AMFService.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
var responder:Responder = new Responder(AMF_MyUserInfo, AMF_onFault);
AMFService.call("Danisman.GetUserWithIdentifier", responder, user_identifier);
// I NEED TO USE returned object data here!!
}
on AMF_MyUserInfo() function I can get object returned from Responder and I can trace it successfully, here is the code
private function AMF_MyUserInfo(res:Object):void {
AMF_onResult(res);
trace(res.user_ID + res.username);
}
But to use outside the AMF_MyUserInfo() function I want to copy that “res” object to another object. I tried with specifing an object in Class and set res to this object in AMF_MyuserInfo() function with “this.myobject = res” but it didn’t work. I also tried “this.myobject.username = res.username” but it didn’t work also.
I’m newbie to OOP, how can I use this res object globally or in AMFinit() function?
Thanks for your help…
if you can trace the
resvalue in the function then everything should be ok. Can not tell what can be wrong.However i’m not familiar with AMF services. So can not tell you how it handles your
resobject. Because this what is happeing with objects in AS3:If you want to use any property globaly create new class:
Then you can access them like this:
hope it will help you a bit.