This content has been marked as final. Show 3 replies
What you're describing is the way that synchronous calls work. You're not supposed to pull back the result into the method that fires off your asynchronous call.
Looks like you're trying to turn an asynchronous thing into a synchronous thing. Instead you just need to adopt a slightly different approach.
Declare your variable and set it to null. Make your call to Student.findById(x), but expect it to return void. Make the assignment to your variable in the result handler (the function listening for the result event), and then you're using an asynchronous paradigm.
If you need more help you'll have to post the context of your particular problem (what call you're making, what handlers and variables are involved etc).
You might want to change your Student.findById function to take two parameters: an integer ID and a callback function. The callback function has to take a ResultEvent parameter and from that you get your student.
Thank you both. Your suggestions helped me muddle my way into a solution. I knew I was approaching the problem in a synchronous way, but I didn't know where to go from there.
The next problem is getting my Student object from the webservice to cast into a Student object within my Actionscript. But that's a subject for a different topic.
Again, thank you.