The following code work fine <?xml version="1.0"?> <!-- events/TrapAllKeys.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp();"> <mx:Script><![CDATA[ private function initApp():void { addEventListener(KeyboardEvent.KEY_DOWN, keyHandler); }
private function keyHandler(event:KeyboardEvent):void { t1.text = event.keyCode + "/" + event.charCode; } ]]></mx:Script> <mx:TextInput id="myTextInput"/> <mx:Text id="t1"/> </mx:Application> but keyHandler works when I select TextInput and type something. I will remove the TextInput and I need keyHandler works, do you think if it is possible? the code will like: <?xml version="1.0"?> <!-- events/TrapAllKeys.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp();"> <mx:Script><![CDATA[ private function initApp():void { addEventListener(KeyboardEvent.KEY_DOWN, keyHandler); } private function keyHandler(event:KeyboardEvent):void { t1.text = event.keyCode + "/" + event.charCode; } ]]></mx:Script> <mx:Text id="t1"/> </mx:Application> Thanks Mark