Hello everyone, I'm trying to build a RemoteObject DAO using AS3, but now I got a big problem.
AS3 is a Script language, what it means? AS3 have a bad feature when we talk about synchronism. What's the problem? Example: First I've one MXML file wich have our RemoteObject object: <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300"> <mx:Script> <![CDATA[ import mx.controls.Alert; ]]> </mx:Script> <mx:RemoteObject id="RO_User" endpoint="http://tiago:8080/ScrumBlazeDS/messagebroker/amf" destination="UserService" showBusyCursor="true" fault="Alert.show(event.toString())"> </mx:RemoteObject> </mx:Canvas> Ok, now the DAO file: public function loginUser(username:String, password:String){ ROUserService = new UserRO(); ROUserService.RO_User.login(username,password); ROUserService.RO_User.addEventListener(ResultEvent.RESULT, loginUser_result); } And now the loginUser_result method: public function loginUser_result(event:ResultEvent){ var bool:Boolean = ObjectUtil.copy(event.result) as Boolean; Alert.show(bool.toString()); } Ok, but what's the problem? When I call the method loginUser and I pass a username value and password value, everything got ok. But when the method capture a EventResult type event it redirects the result to the method loginUser_result, and I need a time to get the result. In my interface I call: public function buttonClick():void{ loginUser(user, pass); Alert.show("Test!"); } but this method execs Alert.show previously the loginUser return a boolean result. It will happen in many methods. I can't use setTimeout() or a Timer object. I'm talking about a big system that will run in several diferent machines, and the time in milis can be diferent everytime. I need something more professional. What can I do? Thanks!