flex - How to get the result of a RemoteObject immediately? -
i need make function execute java method , return result. static becouse lot of other functions call function. did this:
public static function fkdescription(dest:string):string{ var jremote:remoteobject = new remoteobject(); var s:string; jremote.destination = dest; jremote.getvalues.addeventlistener(resultevent.result,valresult); jremote.getvalues(); function valresult(event:resultevent):void{ s = event.result string; } return s; }
but function returns null, because valresult() not been called @ end of main function. shoud make fkdescription() return string came remoteobject?
tanks.
that's because http calls asynchronous, have way result. want remove result handler it's own function waits result, it. not possible you're trying accomplish right now, returning value right away.
check here on how async calls.
Comments
Post a Comment