KeyboardController controlls the key map for the action firing.
Thanks Romain for his Fever{
protected static var defaultMnemonicModifier:Array
protected var enabled:Boolean
protected var inited:Boolean
protected var keyJustActed:Boolean
protected var keymap:KeyMap
protected var keySequence:Vector
protected var mnemonicModifier:Array
public function KeyboardManager()
Singleton class,
Don't create instance directly, in stead you should call getInstance().
public static function getDefaultMnemonicModifier():Array
Returns
public function getKeyMap():KeyMap
Returns
public function getMnemonicModifier():Array
Returns
public function init(root:DisplayObjectContainer):void
Init the keyboad manager, it will only start works when it is inited.
Parameters
| root:DisplayObjectContainer — the key trigger root of this keyboard manager.
|
Throws
| — if it is already inited.
|
public function isEnabled():Boolean
Returns
public function isKeyDown(keyCode:uint):Boolean
Returns whether or not the key is down.
Parameters
Returns
| Boolean — true if the specified key is down, false if not.
|
public function isKeyJustActed():Boolean
Returns whether or not just a key action acted when the last key down.
Returns
| Boolean — true if there's key actions acted at last key down, false not.
|
public function isMnemonicModifierDown():Boolean
Returns whether or not the mnemonic modifier keys is down.
Returns
| Boolean — whether or not the mnemonic modifier keys is down.
|
public function registerKeyAction(key:KeyType, action:Function):void
Registers a key action to the default key map of this controller.
Parameters
| key:KeyType — the key type
|
| |
| action:Function — the action
|
See also
public static function setDefaultMnemonicModifier(keyCodes:Array):voidParameters
public function setEnabled(b:Boolean):voidParameters
public function setMnemonicModifier(keyCodes:Array):void
Sets the mnemonic modifier key codes, the default is [Ctrl, Shift], however
for normal UI frameworks, it is [Alt], but because the flashplayer or explorer will
eat [Alt] for thier own mnemonic modifier, so we set our default to [Ctrl, Shift].
Sets null to make it allways keep same to getDefaultMnemonicModifier
Parameters
| keyCodes:Array — the array of key codes to be the mnemoic modifier.
|
public function unregisterKeyAction(key:KeyType):void
Unregisters a key action to the default key map of this controller.
Parameters
See also
Event object type: flash.events.KeyboardEvent
Dispatched when key is down.
Event object type: flash.events.KeyboardEvent
Dispatched when key is up.