Actionscript: Switching back into previous function from event handler function
Posted
by J.Ded.
on Stack Overflow
See other posts from Stack Overflow
or by J.Ded.
Published on 2010-05-13T23:08:20Z
Indexed on
2010/05/13
23:54 UTC
Read the original article
Hit count: 165
I need to return to my original function after capturing an event (downloading something) with another function. The original function needs to return a value, which depends on the downloaded data. So, I'd like to pause original function for the time needed for the download and the eventhandler function to complete it's work, and resume it afterwards.
The obvious way is to set a flag value (both the original function and the eventhandler are within the same class) and make the original function check it until the eventhandler function changes the flag. But that would be wasteful, and my AS is slow enough already:) [other parts of the application utilise some heavy graphics].
Is there another way? Like an event that gets captured "in the middle" of the function? Or some other form of flow control?
© Stack Overflow or respective owner