can anyone help?
Hello, I'm new to AS and i'm having some trouble. This code will not work. I'm getting an error "Error #1502: A script has executed for longer than the default timeout period of 15 seconds.". The problems coming from the while loop but i don't get it. Is there something wrong with calling this loop from the eventListener or can actionscript not handle the loop? Any help would be greatly appreciated, thank you.
all i have on the stage is a mc with the instance name ball.
var rightArrow:Boolean;
var speed:int = 10;
ball.x=100;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener(Event.ENTER_FRAME, everyFrame);
function keyPressed(event:KeyboardEvent):void {
if (event.keyCode == Keyboard.RIGHT) {
moving();
}
}
function everyFrame(event:Event):void {
if (rightArrow) {
ball.x += speed;
}
}
function moving():void{
while(ball.x<200){rightArrow=true;}
rightArrow=false;
}