Say I have the following function:
function foo():void {
var a:Boolean = true;
var b:Boolean = true;
if (a) {
trace("1"); trace("2"); trace("3"); trace("4"); trace("5");
}
if (b) {
trace("A"); trace("B"); trace("C"); trace("D"); trace("E");
}
}
Note that the second if statement is not an “else” and I don’t want it to be.
The trace consistently indicates that the first if statement completes before the second starts. But what if both if statements call several functions that do lots of things? Will everything happen synchronously? Or should I expect that one or more of the functions called in the second if statement might complete before those in the first if statement?
If the behavior is asynchronous, but I want the second if statement to wait until the first on is done, I could set them up in separate functions and have the first call the second when it’s complete. But is there a more elegant way to keep them in the same function and still make the second if statement wait?
Thank you!