Hello everyone!

I am messing around with a flash game, and I have a border that looks like an arcade button and joystick. There is a simple space loop, to make it look like flying.

My problem is that the ship lags when you hit an arrow key. Many video gamers know how annoying it is to not move easily. Thus, this is a big problem.

Please help out, all Ideas are appreciated.


___---^^^---___
RESOURCES

Flash: http://xenelement.blogspot.com/2009/...ce-arcade.html


Code:
var _left:Boolean;
var _right:Boolean;
var _up:Boolean;
var _down:Boolean;
var _fire:Boolean;
var shipspeed:Number=5;

function stagecontrol() {

	stage.addEventListener(KeyboardEvent.KEY_DOWN, KeyDownList);
	stage.addEventListener(KeyboardEvent.KEY_UP, KeyUpList);

}

function KeyDownList(joyEventGo:KeyboardEvent):void {
	if (joyEventGo.keyCode==37) {
		_left=true;
		moveLeft();
	}
	if (joyEventGo.keyCode==39) {
		_right=true;
		moveRight();
	}
	if (joyEventGo.keyCode==38) {
		_up=true;
		moveUp();
	}
	if (joyEventGo.keyCode==40) {
		_down=true;
		moveDown();
	}
	if (joyEventGo.keyCode==Keyboard.SPACE) {
		_fire=true;
		fireGun();
	}
}

function KeyUpList(joyEventStop:KeyboardEvent):void {
	if (joyEventStop.keyCode==Keyboard.LEFT) {
		_left=false;
		joystickReset();
	}
	if (joyEventStop.keyCode==Keyboard.RIGHT) {
		_right=false;
		joystickReset();
	}
	if (joyEventStop.keyCode==Keyboard.UP) {
		_up=false;
		joystickReset();
	}
	if (joyEventStop.keyCode==Keyboard.DOWN) {
		_down=false;
		joystickReset();
	}
	if (joyEventStop.keyCode==Keyboard.SPACE) {
		fire_button.gotoAndStop("up");
		_fire=false;
	}
}

function moveLeft() {
	if (_left) {
		joystick.gotoAndStop("left");
		spaceship.x-=shipspeed;
	}
}

function moveRight() {
	if (_right) {
		spaceship.x+=shipspeed;
		joystick.gotoAndStop("right");
	}
}

function moveUp() {
	if (_up) {
		spaceship.y-=shipspeed;
		joystick.gotoAndStop("up");
	}
}

function moveDown() {
	if (_down) {
		spaceship.y+=shipspeed;
		joystick.gotoAndStop("down");
	}
}

function fireGun() {
	if (_fire) {
		fire_button.gotoAndStop("down");
	}
}
function joystickReset() {
	if (! _left&&! _right&&! _up&&! _down) {
		joystick.gotoAndStop("middle");
	}
}
stagecontrol();