"Unless I am missing something..."
Actually, in the lines:
model.addEventListener("eventType", eventListener);
var result:MyAsyncToken = model.doAction(...);
result.myData = ....
The assignment to result.myData happens before the data service call is
invoked, and this will work fine. I believe that call does not happen
until the next "frame".
I would avoid using the word 'result" as a variable, and the event type
should be ResultEvent.
Tracy
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Peter
Sent: Friday, March 23, 2007 5:42 PM
To: [email protected]
Subject: RE: [flexcoders] Re: How to asynchronously dispatch an event
Thanks for the guidance, and apologies if I am asking very newbie
questions.
While I have a decent Java background, I do have a lot of new flex/flash
things to try and get a grip on.
>
> I don't see why you can't use the equivalent of an AsyncToken in a
sync
> call if you really want to. I don't understand the problem.
Well, I would like to do something like
model.addEventListener("eventType", eventListener);
var result:MyAsyncToken = model.doAction(...);
result.myData = ....
Unless I am missing something, the "problem" is that doAction
synchronously
invokes the eventListener (by invoking dispatchEvent) and therefore the
value assigned to result.myData never makes it in the eventListener.
>
> There's at least one DoLater.as class floating around in AS2..a
doLater is
> basically just adding an onEnterFrame to an handy MovieClip that calls
a
> given method and then removes itself.
I'll try to find what you refer to. Having no flash experience I will
have
to do a bit of reading to figure out how all this would match up with
the
scenario above, but it certainly helps me to find the direction to start
looking.
Much appreciated!
Peter