Event Flex


    creationComplete="init()">
    
        
        
            import mx.controls.Alert;           
            import flash.events.KeyboardEvent;
            private function init():void 
            {
                this.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler  ); 
            }
            private function keyHandler  (evt:KeyboardEvent):void 
            {
                myText.text += "The key with the keycode" + evt.keyCode + " \n";
            }