Keyboard Events for Right and Left keys
Here is my code:
Quote:
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler71);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler71);
stage.addEventListener(KeyboardEvent.Key.RIGHT, keyRightHandler71);
stage.addEventListener(KeyboardEvent.Key.ESCAPE, keyEscapeHandler71);
stage.addEventListener(KeyboardEvent.Key.ENTER, keyEnterHandler71);
function keyDownHandler71(event:KeyboardEvent):void {
gotoAndPlay("edgeofdarkness");
}
function keyUpHandler71(event:KeyboardEvent):void {
gotoAndPlay("home1");
}
function keyRightHandler71(event:KeyboardEvent):void {
gotoAndPlay("avatar");
}
function keyEscapeHandler71(event:KeyboardEvent):void {
gotoAndPlay("end");
}
function keyEnterHandler71(event:KeyboardEvent):void {
gotoAndPlay("loadingitscomplicated");
}
The code for KEY_UP and KEY_DOWN seems to work fine. But, the rest of it returns the error "1119: Access of possibly undefined property Key through a reference with static type Class." What the hell?
How do you call a function for Right, Left, Enter, and Escape Keys?