Let’s say i’m developing a chessgame, that evaluates moves in a while loop. I want the user to stop the game from looping, and give the move she’s come up with so far. Just to stop the waiting for the user. I came up with this (the enterframe is there to let it compile):
firstTime = true;
this.onEnterFrame = function() {
if (Key.isDown(13) && firstTime == true) {
firstTime = false;
i = 0;
a = 0;
aap.text = "";
while (i<1) {
if (Key.isDown(32)) {
trace("Breekiebreekie "+a);
break;
}
aap.text = a;
a++;
}
}
};
Okay, what happens? For me, it stops the loop, but it doesn’t trace.
aap is a textfield, and it roughly displays the same number every time i try and press space. How come?