I get This error: 1119: Access of possibly undefined property charCode through a reference with static type Class.
function reportKeyDown(event:KeyboardEvent):void{
var KeyCharCode:uint = Event.charCode;
if (KeyCharCode == 37){ // 97 = a 37 = left
Cannon.rotation -= RotationMS;}
var KeyCharCode:uint = Event.charCode;
if (KeyCharCode == 39){ // 100 = d 39 = right
Cannon.rotation += RotationMS;}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
function reportKeyDown(event:KeyboardEvent):void{
var KeyCharCode:uint = Event.charCode;
if (KeyCharCode == 37){ // 97 = a 37 = left
Cannon.rotation -= RotationMS;}
var KeyCharCode:uint = Event.charCode;
if (KeyCharCode == 39){ // 100 = d 39 = right
Cannon.rotation += RotationMS;}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);