Development Flash ActionScript

package {
    import flash.display.Sprite;
    import flash.events.KeyboardEvent;
    
    public class Main extends Sprite {
        public function Main(  ) {
            stage.focus = this;
            addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
        }
        
        private function onKeyDown(event:KeyboardEvent):void {
            trace("key down: " + event.charCode);
        }
    }
}