Name

LzKeys (as2) — Keyboard input service.

Synopsis

JavaScript: LzKeys
Type: Object
Access: public
Runtimes: as2
Topic: LFC.Events
Declared in: WEB-INF/lps/lfc/services/platform/swf/LzKeys.as

Description

LzKeys is a service that provides key handling messages. Objects can also register callbacks to be sent when specific key combinitions are down.

Here is a simple example:

Example 11. LzKeys

 
<canvas height="140" debug="true">
   <handler name="onkeydown" reference="LzKeys" args="k">
     Debug.write("key " + k + " down");
   </handler>
   <handler name="onkeyup" reference="LzKeys" args="k">
     Debug.write("key " + k + " up");
   </handler>
   <method name="pressA">
     Debug.write("A pressed");
   </method>
   <handler name="oninit">
     del = new LzDelegate(this, "pressA");
     LzKeys.callOnKeyCombo(del, ["A"]);
   </handler> 
 </canvas>

Details

Static Properties (5)

downKeysArray
static public var downKeysArray : [Number];
An array of currently pressed key codes.
downKeysHash
static public var downKeysHash : Object = { ... };
A hash where each of the keys that is currently down on the keyboard is set to true.
keyCodes
static public var keyCodes : Object = { ... };
A hash that maps key names to key codes.
keycombos
static public var keycombos = { ... };
mousewheeldelta
static public var mousewheeldelta = 0.0;

Static Methods (8)

callOnKeyCombo()
static public function callOnKeyCombo(d : LzDelegate, kCArr);
Instructs the service to call the given delegate whenever the given key combination is pressed. The names for recognized special keys are (case-insensitive):
  • numbpad0
  • numbpad1
  • numbpad2
  • numbpad3
  • numbpad4
  • numbpad5
  • numbpad6
  • numbpad7
  • numbpad8
  • numbpad9
  • multiply
  • enter
  • subtract
  • decimal
  • divide
  • f1
  • f2
  • f3
  • f4
  • f5
  • f6
  • f7
  • f8
  • f9
  • f10
  • f11
  • f12
  • backspace
  • tab
  • clear
  • enter
  • shift
  • control
  • alt
  • capslock
  • esc
  • spacebar
  • pageup
  • pagedown
  • end
  • home
  • leftarrow
  • uparrow
  • rightarrow
  • downarrow
  • insert
  • help
  • numlock
  • add
  • delete
  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • [
  • @
  • #
  • $
  • %
  • ^
  • &
  • *
  • *
  • (
  • )
  • ;
  • :
  • =
  • +
  • -
  • _
  • /
  • ?
  • ~
  • [
  • {
  • \
  • |
  • ]
  • }
  • "
  • '
enableEnter()
static private function enableEnter(onroff);
getDownKeys()
static public function getDownKeys();
gotKeyDown()
static private function gotKeyDown(kC : Number, info : string);
Called whenever a key is pressed with the Flash keycode corresponding to the down key.
gotKeyUp()
static private function gotKeyUp(kC : Number);
Called whenever the a key is released with the Flash keycode corresponding to the up key.
isKeyDown()
static public function isKeyDown(k : String) : Boolean;
__keyEvent()
static private function __keyEvent(delta, k, type);
removeKeyComboCall()
static public function removeKeyComboCall(d : LzDelegate, kCArr);
Removes the request to call the delegate on the keycombo.

Static Events (3)

onkeydown (as2)
static public event onkeydown;
event sent when a key is pressed; sent with keycode for key that was pressed.
onkeyup (as2)
static public event onkeyup;
event sent whenever a key goes up; sent with keycode for key that was let go.
onmousewheeldelta (as2)
static public event onmousewheeldelta;

JavaScript Synopsis

public var LzKeys = { ... };