This content has been marked as final. Show 4 replies
This might be quite a shift in thinking, however if you use the Cairngorm Framework, and then use the SequenceCommands from the CairngormDocs site that would only trigger your next command in the sequence.
Cairngorm, is available on the Adobe Labs site, its quite a bit to get your head around, but is well worthwhile when you do... Check on the www.cairngormdocs.org site for help with Cairngorm..
"suspend the main thread, pending a remote call.." No. Can't be done.
..."pass arguments into the resultHandler..." Yes, this is done using the AsyncToken. (ACT pattern)
The send() methods returns an AsyncToken object. You can use this dynamic object to add almost anything you want to the token, including strings, and functions (google the term "closure").
As I am still not comfortable with anonymous functions, I like to pass strings. I pass an identifier, which I can use in a switch statement to determine the next step. Sometimes I pass a "nextStep" string to define finer grain conditionality.
I use a single dataService object and result handler function for all calls.
Wow I never understoood what AsyncToken did before, but you're right this is the solution.
I also notice AsyncRequest, and I need to find a way to advise the user if a remote call fails due to his internet connection having failed for some reason. Is there a way to specifically identify 'no internet connection' when remote service called and report it using AsyncRequest?
Thanks for your help,
Sorry, I haven't used that.