Reputation: 128
I have discovered something that really baffles me concerning the actionscript for-loops.
I have an AIR app that has a for loop:
for (var k:int = 0; k < 10; k++)
{
Alert.show(k.toString(), "Message", Alert.YES);
}
But the output starts at 10 counting backwards to 0. Is this just all in the way AIR is compiled at runtime or does the loop actually run backwards?
Upvotes: 0
Views: 75
Reputation: 10325
The loop itself does not run backwards, of course. When you pop up a new Alert
using Alert.show(...
, the Alert shows on top of everything else already displayed.
So, your first Alert, with "0" pops up first.
Next, the Alert with "1" pops up (on top of the Alert with "0")
...
Finally, the Alert with "9" pops up (on top of the other Alerts)
Upvotes: 4