package { import flash.display.*; import flash.events.*; public class Main extends Sprite { public function Main ( ) { stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownListener); } private function keyDownListener (e:KeyboardEvent):void { trace("A key was pressed."); } } }