| Scene 1, Layer 'Layer 1', Frame 1, Line 5 | 1119: Access of possibly undefined property LEFT through a reference with static type Class. |
| Scene 1, Layer 'Layer 1', Frame 1, Line 6 | 1119: Access of possibly undefined property DOWN through a reference with static type Class. |
| Scene 1, Layer 'Layer 1', Frame 1, Line 7 | 1119: Access of possibly undefined property UP through a reference with static type Class. |
| Scene 1, Layer 'Layer 1', Frame 1, Line 8 | 1119: Access of possibly undefined property RIGHT through a reference with static type Class. |
I think have to set Keyboard.Event.LEFT,UP,DOWN,RIGHT to public but not sure how.
import flash.events.KeyboardEvent;
stage.addEventListener(KeyboardEvent.LEFT, characterMove);
stage.addEventListener(KeyboardEvent.DOWN, characterMove); \\\ Event listeners for keyboard up left etc.
stage.addEventListener(KeyboardEvent.UP, characterMove);
stage.addEventListener(KeyboardEvent.RIGHT, characterMove);
new public; function characterMove(evt:KeyboardEvent):void { \\ function to move person
switch (evt.keyCode){
case Keyboard.LEFT:
person.x -= 20;
case Keyboard.RIGHT:
person.x += 20;
case Keyboard.DOWN:
person.y -= 20;
case Keyboard.UP :
person.y += 20;
default:
trace("Keyboard Event Error")
}
}
North America
Europe, Middle East and Africa
Asia Pacific