Implements key listening system.
2 ways are available to listen to keys event.
If using Event implementation, use addKeyListener and removeKeyListener methods to manage key listeners.
If using FrontController implementation,
use push and remove methods to manage key
Command listener.
Take a look at Keyboard class to see all Key constantdefinition. Defines keys sequence using KeyCombo class.
Note : Combo are not available with KeyUp listening system.
Example
var controller : KeyboardController = KeyboardController.getInstance(); //defines shortcut with FrontController behaviour controller.push( Keyboard.onKeyA, new KeyACommand() ); //defines shortcut using event listening controller.addKeyListener(Keyboard.onKeyV, this, _onKeyV); //defines a combo //Note : Name (Ctrl+T) must be logic, it's used for accessibility shortcut definiton controller.push( new KeyCombo( Keyboard.onKeyCONTROL, Keyboard.onKeyT ), new KeyComboCommand() ); //simulate shortcut activation controller.broadcastEvent( Keyboard.onKeyG );
static public keyDown:Booleanstatic public keyUp:BooleanNote that Combo are not available with KeyUp system.
static public function getInstance():KeyboardController
Creates and returns KeyboardController instance.
Always return same instance.
KeyboardController instance
static public function clean():VoidForce keydown list cleaning.
Really useful, for example, when a context dialog box open. Either Flash player doesn't know about 'KeyUp' state.