I need to make a function that execute a java method and return his result. It is static becouse a lot of other functions will call this function. So I 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 as String;
}
return s;
}
But the function returns null, because the valresult() was not been called at the end of main function. What shoud I do to make FKDescription() return the string that came from remoteobject?
Tanks.