Hey everyone! I have a virtual joystick that I am making for one of my games, and I'm having a problem with the KEY_DOWN command. Here's my code so far.

Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, joyKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, joyKeyUp);

function joyKeyDown(joyEventGo:KeyboardEvent):void {
	if (joyEventGo.keyCode==Keyboard.LEFT) {
		joystick.gotoAndPlay(2);
	}
}

function joyKeyUp(joyEventStop:KeyboardEvent):void {
	if (joyEventStop.keyCode==Keyboard.LEFT) {
		joystick.gotoAndPlay(1);
	}
}
My problem is that I cant seem to get it to stop looping. I have a joystick in normal position in frame 1 of the joystick MC, and other positions in the other 4 frames.

Here's what my code makes the joystick do.

\ / \ / \ / \ / \ / \ / \ / \

it flashes back and forth. I cant get it to stop pinging the function for gotoAndPlay, so it wont stop going to the right position.


Can someone please fix my code?


Thanks, Xen Element