The Keyboard class is used to build an interface that can be controlled by a user with a standard keyboard. You can use the methods and properties of the Keyboard class without using a constructor. The properties of the Keyboard class are constants representing the keys that are most commonly used to control games.

Static variables

@:value(65)staticinlineread onlyA:Int = 65

Constant associated with the key code value for the A key(65).

@:value(18)staticinlineread onlyALTERNATE:Int = 18

Constant associated with the key code value for the Alternate(Option) key (18).

@:value(66)staticinlineread onlyB:Int = 66

Constant associated with the key code value for the B key(66).

@:value(192)staticinlineread onlyBACKQUOTE:Int = 192

Constant associated with the key code value for the ` key(192).

@:value(220)staticinlineread onlyBACKSLASH:Int = 220

Constant associated with the key code value for the \ key(220).

@:value(8)staticinlineread onlyBACKSPACE:Int = 8

Constant associated with the key code value for the Backspace key(8).

@:value(67)staticinlineread onlyC:Int = 67

Constant associated with the key code value for the C key(67).

@:value(20)staticinlineread onlyCAPS_LOCK:Int = 20

Constant associated with the key code value for the Caps Lock key(20).

@:value(188)staticinlineread onlyCOMMA:Int = 188

Constant associated with the key code value for the , key(188).

@:value(15)staticinlineread onlyCOMMAND:Int = 15

Constant associated with the Mac command key(15). This constant is currently only used for setting menu key equivalents.

@:value(17)staticinlineread onlyCONTROL:Int = 17

Constant associated with the key code value for the Control key(17).

@:value(68)staticinlineread onlyD:Int = 68

Constant associated with the key code value for the D key(68).

@:value(46)staticinlineread onlyDELETE:Int = 46

Constant associated with the key code value for the Delete key(46).

@:value(40)staticinlineread onlyDOWN:Int = 40

Constant associated with the key code value for the Down Arrow key(40).

@:value(69)staticinlineread onlyE:Int = 69

Constant associated with the key code value for the E key(69).

@:value(35)staticinlineread onlyEND:Int = 35

Constant associated with the key code value for the End key(35).

@:value(13)staticinlineread onlyENTER:Int = 13

Constant associated with the key code value for the Enter key(13).

@:value(187)staticinlineread onlyEQUAL:Int = 187

Constant associated with the key code value for the:Int = key(187).

@:value(27)staticinlineread onlyESCAPE:Int = 27

Constant associated with the key code value for the Escape key(27).

@:value(70)staticinlineread onlyF:Int = 70

Constant associated with the key code value for the F key(70).

@:value(112)staticinlineread onlyF1:Int = 112

Constant associated with the key code value for the F1 key(112).

@:value(121)staticinlineread onlyF10:Int = 121

Constant associated with the key code value for the F10 key(121).

@:value(122)staticinlineread onlyF11:Int = 122

Constant associated with the key code value for the F11 key(122).

@:value(123)staticinlineread onlyF12:Int = 123

Constant associated with the key code value for the F12 key(123).

@:value(124)staticinlineread onlyF13:Int = 124

Constant associated with the key code value for the F13 key(124).

@:value(125)staticinlineread onlyF14:Int = 125

Constant associated with the key code value for the F14 key(125).

@:value(126)staticinlineread onlyF15:Int = 126

Constant associated with the key code value for the F15 key(126).

@:value(113)staticinlineread onlyF2:Int = 113

Constant associated with the key code value for the F2 key(113).

@:value(114)staticinlineread onlyF3:Int = 114

Constant associated with the key code value for the F3 key(114).

@:value(115)staticinlineread onlyF4:Int = 115

Constant associated with the key code value for the F4 key(115).

@:value(116)staticinlineread onlyF5:Int = 116

Constant associated with the key code value for the F5 key(116).

@:value(117)staticinlineread onlyF6:Int = 117

Constant associated with the key code value for the F6 key(117).

@:value(118)staticinlineread onlyF7:Int = 118

Constant associated with the key code value for the F7 key(118).

@:value(119)staticinlineread onlyF8:Int = 119

Constant associated with the key code value for the F8 key(119).

@:value(120)staticinlineread onlyF9:Int = 120

Constant associated with the key code value for the F9 key(120).

@:value(71)staticinlineread onlyG:Int = 71

Constant associated with the key code value for the G key(71).

@:value(72)staticinlineread onlyH:Int = 72

Constant associated with the key code value for the H key(72).

@:value(36)staticinlineread onlyHOME:Int = 36

Constant associated with the key code value for the Home key(36).

@:value(73)staticinlineread onlyI:Int = 73

Constant associated with the key code value for the I key(73).

@:value(45)staticinlineread onlyINSERT:Int = 45

Constant associated with the key code value for the Insert key(45).

@:value(74)staticinlineread onlyJ:Int = 74

Constant associated with the key code value for the J key(74).

@:value(75)staticinlineread onlyK:Int = 75

Constant associated with the key code value for the K key(75).

@:value(76)staticinlineread onlyL:Int = 76

Constant associated with the key code value for the L key(76).

@:value(37)staticinlineread onlyLEFT:Int = 37

Constant associated with the key code value for the Left Arrow key(37).

@:value(219)staticinlineread onlyLEFTBRACKET:Int = 219

Constant associated with the key code value for the [ key(219).

@:value(77)staticinlineread onlyM:Int = 77

Constant associated with the key code value for the M key(77).

@:value(189)staticinlineread onlyMINUS:Int = 189

Constant associated with the key code value for the - key(189).

@:value(78)staticinlineread onlyN:Int = 78

Constant associated with the key code value for the N key(78).

@:value(48)staticinlineread onlyNUMBER_0:Int = 48

Constant associated with the key code value for the 0 key(48).

@:value(49)staticinlineread onlyNUMBER_1:Int = 49

Constant associated with the key code value for the 1 key(49).

@:value(50)staticinlineread onlyNUMBER_2:Int = 50

Constant associated with the key code value for the 2 key(50).

@:value(51)staticinlineread onlyNUMBER_3:Int = 51

Constant associated with the key code value for the 3 key(51).

@:value(52)staticinlineread onlyNUMBER_4:Int = 52

Constant associated with the key code value for the 4 key(52).

@:value(53)staticinlineread onlyNUMBER_5:Int = 53

Constant associated with the key code value for the 5 key(53).

@:value(54)staticinlineread onlyNUMBER_6:Int = 54

Constant associated with the key code value for the 6 key(54).

@:value(55)staticinlineread onlyNUMBER_7:Int = 55

Constant associated with the key code value for the 7 key(55).

@:value(56)staticinlineread onlyNUMBER_8:Int = 56

Constant associated with the key code value for the 8 key(56).

@:value(57)staticinlineread onlyNUMBER_9:Int = 57

Constant associated with the key code value for the 9 key(57).

@:value(21)staticinlineread onlyNUMPAD:Int = 21

Constant associated with the pseudo-key code for the the number pad(21). Use to set numpad modifier on key equivalents

@:value(96)staticinlineread onlyNUMPAD_0:Int = 96

Constant associated with the key code value for the number 0 key on the number pad(96).

@:value(97)staticinlineread onlyNUMPAD_1:Int = 97

Constant associated with the key code value for the number 1 key on the number pad(97).

@:value(98)staticinlineread onlyNUMPAD_2:Int = 98

Constant associated with the key code value for the number 2 key on the number pad(98).

@:value(99)staticinlineread onlyNUMPAD_3:Int = 99

Constant associated with the key code value for the number 3 key on the number pad(99).

@:value(100)staticinlineread onlyNUMPAD_4:Int = 100

Constant associated with the key code value for the number 4 key on the number pad(100).

@:value(101)staticinlineread onlyNUMPAD_5:Int = 101

Constant associated with the key code value for the number 5 key on the number pad(101).

@:value(102)staticinlineread onlyNUMPAD_6:Int = 102

Constant associated with the key code value for the number 6 key on the number pad(102).

@:value(103)staticinlineread onlyNUMPAD_7:Int = 103

Constant associated with the key code value for the number 7 key on the number pad(103).

@:value(104)staticinlineread onlyNUMPAD_8:Int = 104

Constant associated with the key code value for the number 8 key on the number pad(104).

@:value(105)staticinlineread onlyNUMPAD_9:Int = 105

Constant associated with the key code value for the number 9 key on the number pad(105).

@:value(107)staticinlineread onlyNUMPAD_ADD:Int = 107

Constant associated with the key code value for the addition key on the number pad(107).

@:value(110)staticinlineread onlyNUMPAD_DECIMAL:Int = 110

Constant associated with the key code value for the decimal key on the number pad(110).

@:value(111)staticinlineread onlyNUMPAD_DIVIDE:Int = 111

Constant associated with the key code value for the division key on the number pad(111).

@:value(108)staticinlineread onlyNUMPAD_ENTER:Int = 108

Constant associated with the key code value for the Enter key on the number pad(108).

@:value(106)staticinlineread onlyNUMPAD_MULTIPLY:Int = 106

Constant associated with the key code value for the multiplication key on the number pad(106).

@:value(109)staticinlineread onlyNUMPAD_SUBTRACT:Int = 109

Constant associated with the key code value for the subtraction key on the number pad(109).

@:value(79)staticinlineread onlyO:Int = 79

Constant associated with the key code value for the O key(79).

@:value(80)staticinlineread onlyP:Int = 80

Constant associated with the key code value for the P key(80).

@:value(34)staticinlineread onlyPAGE_DOWN:Int = 34

Constant associated with the key code value for the Page Down key(34).

@:value(33)staticinlineread onlyPAGE_UP:Int = 33

Constant associated with the key code value for the Page Up key(33).

@:value(190)staticinlineread onlyPERIOD:Int = 190

Constant associated with the key code value for the . key(190).

@:value(81)staticinlineread onlyQ:Int = 81

Constant associated with the key code value for the Q key(81).

@:value(222)staticinlineread onlyQUOTE:Int = 222

Constant associated with the key code value for the ' key(222).

@:value(82)staticinlineread onlyR:Int = 82

Constant associated with the key code value for the R key(82).

@:value(39)staticinlineread onlyRIGHT:Int = 39

Constant associated with the key code value for the Right Arrow key(39).

@:value(221)staticinlineread onlyRIGHTBRACKET:Int = 221

Constant associated with the key code value for the ] key(221).

@:value(83)staticinlineread onlyS:Int = 83

Constant associated with the key code value for the S key(83).

@:value(186)staticinlineread onlySEMICOLON:Int = 186

Constant associated with the key code value for the ; key(186).

@:value(16)staticinlineread onlySHIFT:Int = 16

Constant associated with the key code value for the Shift key(16).

@:value(191)staticinlineread onlySLASH:Int = 191

Constant associated with the key code value for the / key(191).

@:value(32)staticinlineread onlySPACE:Int = 32

Constant associated with the key code value for the Spacebar(32).

@:value(84)staticinlineread onlyT:Int = 84

Constant associated with the key code value for the T key(84).

@:value(9)staticinlineread onlyTAB:Int = 9

Constant associated with the key code value for the Tab key(9).

@:value(85)staticinlineread onlyU:Int = 85

Constant associated with the key code value for the U key(85).

@:value(38)staticinlineread onlyUP:Int = 38

Constant associated with the key code value for the Up Arrow key(38).

@:value(86)staticinlineread onlyV:Int = 86

Constant associated with the key code value for the V key(85).

@:value(87)staticinlineread onlyW:Int = 87

Constant associated with the key code value for the W key(87).

@:value(88)staticinlineread onlyX:Int = 88

Constant associated with the key code value for the X key(88).

@:value(89)staticinlineread onlyY:Int = 89

Constant associated with the key code value for the Y key(89).

@:value(90)staticinlineread onlyZ:Int = 90

Constant associated with the key code value for the Z key(90).

staticread onlycapsLock:Bool

Specifies whether the Caps Lock key is activated(true) or not(false).

staticread onlynumLock:Bool

Specifies whether the Num Lock key is activated(true) or not (false).

Static methods

staticisAccessible():Bool

Specifies whether the last key pressed is accessible by other SWF files. By default, security restrictions prevent code from a SWF file in one domain from accessing a keystroke generated from a SWF file in another domain.

Returns:

The value true if the last key pressed can be accessed. If access is not permitted, this method returns false.