| Package | sekati.managers |
| Class | public final class KeyManager |
import sekati.ui.Keyboard // create a response relationship between a key and method (non-repeatable): KeyManager.$.addKeyListener( handler, false, Keyboard.UP ); // create a response between a key combo and a method (repeatable): KeyManager.$.addKeyListener( handler, true, Keyboard.CONTROL, Keyboard.LEFT );
See also
| Property | Defined by | ||
|---|---|---|---|
| $ : KeyManager
[static][read-only]
Shorthand singleton accessor getter
| KeyManager | ||
| enabled : Boolean
Indicates whether the KeyManager is enabled (
true) or disabled (false). | KeyManager | ||
| Method | Defined by | ||
|---|---|---|---|
|
KeyManager($:SingletonEnforcer = null)
KeyManager Singleton Constructor
| KeyManager | ||
|
addKeyListener(handler:Function, repeat:Boolean = false, ... keys):void
Add a key or key combo.
| KeyManager | ||
|
destroy():void
Destroy the KeyManager instance.
| KeyManager | ||
|
[static]
Singleton Accessor
| KeyManager | ||
|
isDown(keyCode:uint):Boolean
Returns true or false if the key represented by the
keyCode passed is being pressed
| KeyManager | ||
|
removeKeyListener(handler:Function):void
Remove a key or key combo.
| KeyManager | ||
|
reset():void
Reset the Key Combo and Map.
| KeyManager | ||
| Method | Defined by | ||
|---|---|---|---|
|
clearKeys(e:Event = null):void
Clear the keyMap.
| KeyManager | ||
|
keyCheck():void
Check the key press to see if it matches our handlers.
| KeyManager | ||
|
keyPressHandler(e:KeyboardEvent = null):void
Add the key to the
keyMap. | KeyManager | ||
|
keyReleaseHandler(e:KeyboardEvent = null):void
Remove the key from the
keyMap. | KeyManager | ||
| $ | property |
$:KeyManager [read-only]Shorthand singleton accessor getter
Implementation public static function get $():KeyManager
| enabled | property |
enabled:Boolean [read-write]
Indicates whether the KeyManager is enabled (true) or disabled (false).
public function get enabled():Boolean
public function set enabled(value:Boolean):void
| KeyManager | () | constructor |
public function KeyManager($:SingletonEnforcer = null)KeyManager Singleton Constructor
Parameters$:SingletonEnforcer (default = null) — SingletonEnforcer - internal to the AS file; the param prevents external instantiation without error.
|
| addKeyListener | () | method |
public function addKeyListener(handler:Function, repeat:Boolean = false, ... keys):voidAdd a key or key combo.
Parametershandler:Function — the function to be fired upon a complete key match.
|
|
repeat:Boolean (default = false) — if true depressed key handler will fire repeatedly, if false key handler will fire only once per press.
|
|
... keys — array of keyCodes (uint's) which will trigger the handler.
|
KeyManager.$.addKeyListener( runProgram, false, KeyManager.$.CONTROL, KeyManager.$.ENTER ); KeyManager.$.addKeyListener( copyText, true, KeyManager.$.CONTROL, KeyManager.$.C );
| clearKeys | () | method |
protected function clearKeys(e:Event = null):voidClear the keyMap.
Parameterse:Event (default = null) |
| destroy | () | method |
public function destroy():voidDestroy the KeyManager instance.
| getInstance | () | method |
| isDown | () | method |
public function isDown(keyCode:uint):BooleanReturns true or false if the key represented by the keyCode passed is being pressed
ParameterskeyCode:uint |
Boolean |
| keyCheck | () | method |
protected function keyCheck():voidCheck the key press to see if it matches our handlers.
| keyPressHandler | () | method |
protected function keyPressHandler(e:KeyboardEvent = null):void
Add the key to the keyMap.
e:KeyboardEvent (default = null) |
| keyReleaseHandler | () | method |
protected function keyReleaseHandler(e:KeyboardEvent = null):void
Remove the key from the keyMap.
e:KeyboardEvent (default = null) |
| removeKeyListener | () | method |
public function removeKeyListener(handler:Function):voidRemove a key or key combo.
Parametershandler:Function — the function to be fired upon a complete key match.
|
KeyManager.$.removeKeyListener( runProgram ); KeyManager.$.removeKeyListener( copyText );
| reset | () | method |
public function reset():voidReset the Key Combo and Map.