Be a Supporter!

Edits to post #25314255 by Witch

Back to Keyboard Event

Edited at 2014-11-29 17:05:13

Yuo need to use a callback function. Every physical key has a "keyCode", for A it is 65. So you could write something like this:

stage.addEventListener(KeyboardEvent.KEY_DOWN, pressHandler);

function pressHandler(e:KeyboardEvent):void {
	if (e.keyCode == 65) {
		gotoAndPlay(2);
	}
}

You need to use a callback function. Every physical key has a keyCode, for A it is 65. So you could write something like this:

stage.addEventListener(KeyboardEvent.KEY_DOWN, pressHandler);

function pressHandler(e:KeyboardEvent):void {
	if (e.keyCode == 65) {
		gotoAndPlay(2);
	}
}