Packagecitrus.input.controllers
Classpublic class Keyboard
InheritanceKeyboard Inheritance InputController Inheritance Object

The default Keyboard controller. A single key can trigger multiple actions, each of these can be sent to different channels. Keyboard holds static keycodes constants (see bottom).



Public Properties
 PropertyDefined By
 InheriteddefaultChannel : uint
InputController
 Inheritedenabled : Boolean
InputController
 InheritedhideParamWarnings : Boolean = false
[static]
InputController
  keyNames : Dictionary
Keyboard
 Inheritedname : String
InputController
  onKeyDown : Signal
on native keyboard key down, dispatches keyCode and keyLocation as well as a 'vars' object which you can use to prevent default or stop immediate propagation of the native event.
Keyboard
  onKeyUp : Signal
on native keyboard key up, dispatches keyCode and keyLocation as well as a 'vars' object which you can use to prevent default or stop immediate propagation of the native event.
Keyboard
 InheritedupdateEnabled : Boolean
[read-only]
InputController
Protected Properties
 PropertyDefined By
 Inherited_ce : CitrusEngine
InputController
 Inherited_defaultChannel : uint = 0
InputController
 Inherited_enabled : Boolean = true
InputController
 Inherited_initialized : Boolean
InputController
 Inherited_input : Input
InputController
  _keyActions : Dictionary
Keyboard
 Inherited_updateEnabled : Boolean = false
InputController
Public Methods
 MethodDefined By
  
Keyboard(name:String, params:Object = null)
Keyboard
  
addKeyAction(actionName:String, keyCode:uint, channel:int = -1):void
Add an action to a Key if action doesn't exist on that Key.
Keyboard
  
changeKeyAction(previousKey:uint, newKey:uint):void
Helps swap actions from a key to another key.
Keyboard
  
destroy():void
[override]
Keyboard
  
getActionsByKey(keyCode:uint):Vector.<Object>
Returns all actions on a key in Vector format or returns null if none.
Keyboard
  
getKeyFromAction(actionName:String, channel:int = -1):String
returns the name of the first found key that should trigger the action.
Keyboard
  
getKeysFromAction(actionName:String, channel:int = -1):Array
returns an array of all the names of the keys that will trigger the action.
Keyboard
  
removeAction(actionName:String):void
Removes every actions by name, on every keys.
Keyboard
  
removeActionFromKey(actionName:String, keyCode:uint):void
Removes action from a key code, by name.
Keyboard
  
removeKeyActions(keyCode:uint):void
Removes all actions on a key.
Keyboard
  
Deletes the entire registry of key actions.
Keyboard
 Inherited
toString():String
InputController
 Inherited
update():void
Override this function if you need your controller to update when CitrusEngine updates the Input instance.
InputController
Protected Methods
 MethodDefined By
 Inherited
setParams(object:Object):void
InputController
 Inherited
triggerCHANGE(name:String, value:Number = 0, message:String = null, channel:int = -1):InputAction
Will register the action to the Input system as an action with an InputPhase.BEGIN phase if its not yet in the actions list, otherwise it will update the existing action's value and set its phase back to InputPhase.ON.
InputController
 Inherited
triggerOFF(name:String, value:Number = 0, message:String = null, channel:int = -1):InputAction
Will register the action to the Input system as an action with an InputPhase.END phase.
InputController
 Inherited
triggerON(name:String, value:Number = 0, message:String = null, channel:int = -1):InputAction
Will register the action to the Input system as an action with an InputPhase.BEGIN phase.
InputController
 Inherited
triggerONCE(name:String, value:Number = 0, message:String = null, channel:int = -1):InputAction
Will register the action to the Input system as an action with an InputPhase.END phase if its not yet in the actions list as well as a time to 1 (so that it will be considered as already triggered.
InputController
Public Constants
 ConstantDefined By
  A : uint = 65
[static]
Keyboard
  ALTERNATE : uint = 18
[static]
Keyboard
  AUDIO : uint = 0x01000017
[static]
Keyboard
  AZERTY_CIRCUMFLEX : uint = 221
[static]
Keyboard
  AZERTY_DOLLAR_SIGN : uint = 186
[static]
Keyboard
  AZERTY_EXCLAMATION_MARK : uint = 223
[static]
Keyboard
  AZERTY_MULTIPLY : uint = 220
[static]
Keyboard
  AZERTY_RIGHT_PARENTHESIS : uint = 219
[static]
Keyboard
  AZERTY_SQUARE : uint = 222
[static]
Keyboard
  AZERTY_U_GRAVE : uint = 192
[static]
Keyboard
  B : uint = 66
[static]
Keyboard
  BACK : uint = 0x01000016
[static]
Keyboard
  BACKQUOTE : uint = 192
[static]
Keyboard
  BACKSLASH : uint = 220
[static]
Keyboard
  BACKSPACE : uint = 8
[static]
Keyboard
  BREAK : uint = 19
[static]
Keyboard
  C : uint = 67
[static]
Keyboard
  CAPS_LOCK : uint = 20
[static]
Keyboard
  COMMA : uint = 188
[static]
Keyboard
  COMMAND : uint = 15
[static]
Keyboard
  CTRL : uint = 17
[static]
Keyboard
  D : uint = 68
[static]
Keyboard
  DELETE : uint = 46
[static]
Keyboard
  DOWN : uint = 40
[static]
Keyboard
  E : uint = 69
[static]
Keyboard
  END : uint = 35
[static]
Keyboard
  ENTER : uint = 13
[static]
Keyboard
  EQUAL : uint = 187
[static]
Keyboard
  ESCAPE : uint = 27
[static]
Keyboard
  F : uint = 70
[static]
Keyboard
  F1 : uint = 112
[static]
Keyboard
  F10 : uint = 121
[static]
Keyboard
  F11 : uint = 122
[static]
Keyboard
  F12 : uint = 123
[static]
Keyboard
  F13 : uint = 124
[static]
Keyboard
  F14 : uint = 125
[static]
Keyboard
  F15 : uint = 126
[static]
Keyboard
  F2 : uint = 113
[static]
Keyboard
  F3 : uint = 114
[static]
Keyboard
  F4 : uint = 115
[static]
Keyboard
  F5 : uint = 116
[static]
Keyboard
  F6 : uint = 117
[static]
Keyboard
  F7 : uint = 118
[static]
Keyboard
  F8 : uint = 119
[static]
Keyboard
  F9 : uint = 120
[static]
Keyboard
  G : uint = 71
[static]
Keyboard
  H : uint = 72
[static]
Keyboard
  HOME : uint = 36
[static]
Keyboard
  I : uint = 73
[static]
Keyboard
  INSERT : uint = 45
[static]
Keyboard
  J : uint = 74
[static]
Keyboard
  K : uint = 75
[static]
Keyboard
  L : uint = 76
[static]
Keyboard
  LEFT : uint = 37
[static]
Keyboard
  LEFT_BRACKET : uint = 219
[static]
Keyboard
  M : uint = 77
[static]
Keyboard
  MENU : uint = 0x01000012
[static]
Keyboard
  MINUS : uint = 189
[static]
Keyboard
  N : uint = 78
[static]
Keyboard
  NUMBER_0 : uint = 48
[static]
Keyboard
  NUMBER_1 : uint = 49
[static]
Keyboard
  NUMBER_2 : uint = 50
[static]
Keyboard
  NUMBER_3 : uint = 51
[static]
Keyboard
  NUMBER_4 : uint = 52
[static]
Keyboard
  NUMBER_5 : uint = 53
[static]
Keyboard
  NUMBER_6 : uint = 54
[static]
Keyboard
  NUMBER_7 : uint = 55
[static]
Keyboard
  NUMBER_8 : uint = 56
[static]
Keyboard
  NUMBER_9 : uint = 57
[static]
Keyboard
  NUM_LOCK : uint = 144
[static]
Keyboard
  NUMPAD_0 : uint = 96
[static]
Keyboard
  NUMPAD_1 : uint = 97
[static]
Keyboard
  NUMPAD_2 : uint = 98
[static]
Keyboard
  NUMPAD_3 : uint = 99
[static]
Keyboard
  NUMPAD_4 : uint = 100
[static]
Keyboard
  NUMPAD_5 : uint = 101
[static]
Keyboard
  NUMPAD_6 : uint = 102
[static]
Keyboard
  NUMPAD_7 : uint = 103
[static]
Keyboard
  NUMPAD_8 : uint = 104
[static]
Keyboard
  NUMPAD_9 : uint = 105
[static]
Keyboard
  NUMPAD_ADD : uint = 107
[static]
Keyboard
  NUMPAD_DECIMAL : uint = 110
[static]
Keyboard
  NUMPAD_DIVIDE : uint = 111
[static]
Keyboard
  NUMPAD_ENTER : uint = 13
[static]
Keyboard
  NUMPAD_MULTIPLY : uint = 105
[static]
Keyboard
  NUMPAD_SUBTRACT : uint = 109
[static]
Keyboard
  O : uint = 79
[static]
Keyboard
  P : uint = 80
[static]
Keyboard
  PAGE_DOWN : uint = 34
[static]
Keyboard
  PAGE_UP : uint = 33
[static]
Keyboard
  PERIOD : uint = 190
[static]
Keyboard
  Q : uint = 81
[static]
Keyboard
  QUOTE : uint = 222
[static]
Keyboard
  R : uint = 82
[static]
Keyboard
  RIGHT : uint = 39
[static]
Keyboard
  RIGHT_BRACKET : uint = 221
[static]
Keyboard
  S : uint = 83
[static]
Keyboard
  SCROLL_LOCK : uint = 145
[static]
Keyboard
  SEARCH : uint = 0x0100001F
[static]
Keyboard
  SEMICOLON : uint = 186
[static]
Keyboard
  SHIFT : uint = 16
[static]
Keyboard
  SLASH : uint = 191
[static]
Keyboard
  SPACE : uint = 32
[static]
Keyboard
  T : uint = 84
[static]
Keyboard
  TAB : uint = 9
[static]
Keyboard
  U : uint = 85
[static]
Keyboard
  UP : uint = 38
[static]
Keyboard
  V : uint = 86
[static]
Keyboard
  W : uint = 87
[static]
Keyboard
  X : uint = 88
[static]
Keyboard
  Y : uint = 89
[static]
Keyboard
  Z : uint = 90
[static]
Keyboard
Property Detail
_keyActionsproperty
protected var _keyActions:Dictionary

keyNamesproperty 
public var keyNames:Dictionary

onKeyDownproperty 
public var onKeyDown:Signal

on native keyboard key down, dispatches keyCode and keyLocation as well as a 'vars' object which you can use to prevent default or stop immediate propagation of the native event. see the code below : public function onSoftKeys(keyCode:int,keyLocation:int,vars:Object):void { switch (keyCode) { case Keyboard.BACK: vars.prevent = true; trace("back button, default prevented."); break; case Keyboard.MENU: trace("menu"); break; case Keyboard.SEARCH: trace("search"); break; case Keyboard.ENTER: vars.stop = true; trace("enter, will not go through the input system because propagation was stopped."); break; } }

onKeyUpproperty 
public var onKeyUp:Signal

on native keyboard key up, dispatches keyCode and keyLocation as well as a 'vars' object which you can use to prevent default or stop immediate propagation of the native event. see the code below : public function onSoftKeys(keyCode:int,keyLocation:int,vars:Object):void { switch (keyCode) { case Keyboard.BACK: vars.prevent = true; trace("back button, default prevented."); break; case Keyboard.MENU: trace("menu"); break; case Keyboard.SEARCH: trace("search"); break; case Keyboard.ENTER: vars.stop = true; trace("enter, will not go through the input system because propagation was stopped."); break; } }

Constructor Detail
Keyboard()Constructor
public function Keyboard(name:String, params:Object = null)



Parameters
name:String
 
params:Object (default = null)
Method Detail
addKeyAction()method
public function addKeyAction(actionName:String, keyCode:uint, channel:int = -1):void

Add an action to a Key if action doesn't exist on that Key.

Parameters

actionName:String
 
keyCode:uint
 
channel:int (default = -1)

changeKeyAction()method 
public function changeKeyAction(previousKey:uint, newKey:uint):void

Helps swap actions from a key to another key.

Parameters

previousKey:uint
 
newKey:uint

destroy()method 
override public function destroy():void

getActionsByKey()method 
public function getActionsByKey(keyCode:uint):Vector.<Object>

Returns all actions on a key in Vector format or returns null if none.

Parameters

keyCode:uint

Returns
Vector.<Object>
getKeyFromAction()method 
public function getKeyFromAction(actionName:String, channel:int = -1):String

returns the name of the first found key that should trigger the action.

Parameters

actionName:String — filter by channel number, if -1, all key/action/channel combinations are considered
 
channel:int (default = -1)

Returns
String
getKeysFromAction()method 
public function getKeysFromAction(actionName:String, channel:int = -1):Array

returns an array of all the names of the keys that will trigger the action.

Parameters

actionName:String — filter by channel number, if -1, all key/action/channel combinations are considered
 
channel:int (default = -1)

Returns
Array
removeAction()method 
public function removeAction(actionName:String):void

Removes every actions by name, on every keys.

Parameters

actionName:String

removeActionFromKey()method 
public function removeActionFromKey(actionName:String, keyCode:uint):void

Removes action from a key code, by name.

Parameters

actionName:String
 
keyCode:uint

removeKeyActions()method 
public function removeKeyActions(keyCode:uint):void

Removes all actions on a key.

Parameters

keyCode:uint

resetAllKeyActions()method 
public function resetAllKeyActions():void

Deletes the entire registry of key actions.

Constant Detail
AConstant
public static const A:uint = 65

ALTERNATEConstant 
public static const ALTERNATE:uint = 18

AUDIOConstant 
public static const AUDIO:uint = 0x01000017

AZERTY_CIRCUMFLEXConstant 
public static const AZERTY_CIRCUMFLEX:uint = 221

AZERTY_DOLLAR_SIGNConstant 
public static const AZERTY_DOLLAR_SIGN:uint = 186

AZERTY_EXCLAMATION_MARKConstant 
public static const AZERTY_EXCLAMATION_MARK:uint = 223

AZERTY_MULTIPLYConstant 
public static const AZERTY_MULTIPLY:uint = 220

AZERTY_RIGHT_PARENTHESISConstant 
public static const AZERTY_RIGHT_PARENTHESIS:uint = 219

AZERTY_SQUAREConstant 
public static const AZERTY_SQUARE:uint = 222

AZERTY_U_GRAVEConstant 
public static const AZERTY_U_GRAVE:uint = 192

BConstant 
public static const B:uint = 66

BACKConstant 
public static const BACK:uint = 0x01000016

BACKQUOTEConstant 
public static const BACKQUOTE:uint = 192

BACKSLASHConstant 
public static const BACKSLASH:uint = 220

BACKSPACEConstant 
public static const BACKSPACE:uint = 8

BREAKConstant 
public static const BREAK:uint = 19

CConstant 
public static const C:uint = 67

CAPS_LOCKConstant 
public static const CAPS_LOCK:uint = 20

COMMAConstant 
public static const COMMA:uint = 188

COMMANDConstant 
public static const COMMAND:uint = 15

CTRLConstant 
public static const CTRL:uint = 17

DConstant 
public static const D:uint = 68

DELETEConstant 
public static const DELETE:uint = 46

DOWNConstant 
public static const DOWN:uint = 40

EConstant 
public static const E:uint = 69

ENDConstant 
public static const END:uint = 35

ENTERConstant 
public static const ENTER:uint = 13

EQUALConstant 
public static const EQUAL:uint = 187

ESCAPEConstant 
public static const ESCAPE:uint = 27

FConstant 
public static const F:uint = 70

F1Constant 
public static const F1:uint = 112

F10Constant 
public static const F10:uint = 121

F11Constant 
public static const F11:uint = 122

F12Constant 
public static const F12:uint = 123

F13Constant 
public static const F13:uint = 124

F14Constant 
public static const F14:uint = 125

F15Constant 
public static const F15:uint = 126

F2Constant 
public static const F2:uint = 113

F3Constant 
public static const F3:uint = 114

F4Constant 
public static const F4:uint = 115

F5Constant 
public static const F5:uint = 116

F6Constant 
public static const F6:uint = 117

F7Constant 
public static const F7:uint = 118

F8Constant 
public static const F8:uint = 119

F9Constant 
public static const F9:uint = 120

GConstant 
public static const G:uint = 71

HConstant 
public static const H:uint = 72

HOMEConstant 
public static const HOME:uint = 36

IConstant 
public static const I:uint = 73

INSERTConstant 
public static const INSERT:uint = 45

JConstant 
public static const J:uint = 74

KConstant 
public static const K:uint = 75

LConstant 
public static const L:uint = 76

LEFTConstant 
public static const LEFT:uint = 37

LEFT_BRACKETConstant 
public static const LEFT_BRACKET:uint = 219

MConstant 
public static const M:uint = 77

MENUConstant 
public static const MENU:uint = 0x01000012

MINUSConstant 
public static const MINUS:uint = 189

NConstant 
public static const N:uint = 78

NUM_LOCKConstant 
public static const NUM_LOCK:uint = 144

NUMBER_0Constant 
public static const NUMBER_0:uint = 48

NUMBER_1Constant 
public static const NUMBER_1:uint = 49

NUMBER_2Constant 
public static const NUMBER_2:uint = 50

NUMBER_3Constant 
public static const NUMBER_3:uint = 51

NUMBER_4Constant 
public static const NUMBER_4:uint = 52

NUMBER_5Constant 
public static const NUMBER_5:uint = 53

NUMBER_6Constant 
public static const NUMBER_6:uint = 54

NUMBER_7Constant 
public static const NUMBER_7:uint = 55

NUMBER_8Constant 
public static const NUMBER_8:uint = 56

NUMBER_9Constant 
public static const NUMBER_9:uint = 57

NUMPAD_0Constant 
public static const NUMPAD_0:uint = 96

NUMPAD_1Constant 
public static const NUMPAD_1:uint = 97

NUMPAD_2Constant 
public static const NUMPAD_2:uint = 98

NUMPAD_3Constant 
public static const NUMPAD_3:uint = 99

NUMPAD_4Constant 
public static const NUMPAD_4:uint = 100

NUMPAD_5Constant 
public static const NUMPAD_5:uint = 101

NUMPAD_6Constant 
public static const NUMPAD_6:uint = 102

NUMPAD_7Constant 
public static const NUMPAD_7:uint = 103

NUMPAD_8Constant 
public static const NUMPAD_8:uint = 104

NUMPAD_9Constant 
public static const NUMPAD_9:uint = 105

NUMPAD_ADDConstant 
public static const NUMPAD_ADD:uint = 107

NUMPAD_DECIMALConstant 
public static const NUMPAD_DECIMAL:uint = 110

NUMPAD_DIVIDEConstant 
public static const NUMPAD_DIVIDE:uint = 111

NUMPAD_ENTERConstant 
public static const NUMPAD_ENTER:uint = 13

NUMPAD_MULTIPLYConstant 
public static const NUMPAD_MULTIPLY:uint = 105

NUMPAD_SUBTRACTConstant 
public static const NUMPAD_SUBTRACT:uint = 109

OConstant 
public static const O:uint = 79

PConstant 
public static const P:uint = 80

PAGE_DOWNConstant 
public static const PAGE_DOWN:uint = 34

PAGE_UPConstant 
public static const PAGE_UP:uint = 33

PERIODConstant 
public static const PERIOD:uint = 190

QConstant 
public static const Q:uint = 81

QUOTEConstant 
public static const QUOTE:uint = 222

RConstant 
public static const R:uint = 82

RIGHTConstant 
public static const RIGHT:uint = 39

RIGHT_BRACKETConstant 
public static const RIGHT_BRACKET:uint = 221

SConstant 
public static const S:uint = 83

SCROLL_LOCKConstant 
public static const SCROLL_LOCK:uint = 145

SEARCHConstant 
public static const SEARCH:uint = 0x0100001F

SEMICOLONConstant 
public static const SEMICOLON:uint = 186

SHIFTConstant 
public static const SHIFT:uint = 16

SLASHConstant 
public static const SLASH:uint = 191

SPACEConstant 
public static const SPACE:uint = 32

TConstant 
public static const T:uint = 84

TABConstant 
public static const TAB:uint = 9

UConstant 
public static const U:uint = 85

UPConstant 
public static const UP:uint = 38

VConstant 
public static const V:uint = 86

WConstant 
public static const W:uint = 87

XConstant 
public static const X:uint = 88

YConstant 
public static const Y:uint = 89

ZConstant 
public static const Z:uint = 90