var listener:Object = new Object(); listener.onKeyDown = function() { trace(Key.getCode()); }; Key.addListener(listener);