LKeyboardEvent Class
A LMouseEvent object is dispatched into the event flow whenever mouse events occur. A mouse event is usually generated by a user input device, such as a mouse or a trackball, that uses a pointer.
In a mobile browser, MOUSE_DOWN, MOUSE_UP, MOUSE_MOVE are automatically converted to TOUCH_DOWN, TOUCH_UP, TOUCH_MOVE.
Constructor
LKeyboardEvent
()
public
Example:
LInit(50, "legend", 800, 80, main);
function main () {
LGlobal.setDebug(true);
var title = new LTextField();
addChild(title);
title.text = "Click the keyboard, please!";
LGlobal.stage.addEventListener(LKeyboardEvent.KEY_DOWN,keydown);
//LEvent.addEventListener(window,LKeyboardEvent.KEY_DOWN,keydown);
LGlobal.stage.addEventListener(LKeyboardEvent.KEY_UP,keyup);
//LEvent.addEventListener(window,LKeyboardEvent.KEY_DOWN,keydown);
LGlobal.stage.addEventListener(LKeyboardEvent.KEY_PRESS,keypress);
//LEvent.addEventListener(window,LKeyboardEvent.KEY_PRESS,keypress);
}
function keydown (e) {
trace("keydown e.keyCode = " + e.keyCode);
}
function keyup (e) {
trace("keyup e.keyCode = " + e.keyCode);
}
function keypress (e) {
trace("keypress e.keyCode = " + e.keyCode);
}
Properties
KEY_DOWN
String
public
static
[static] Defines the value of the type property of a keydown event object.
This event has the following properties:
Property | Value |
---|---|
type | Returns the name of the event |
keyCode | Returns the Unicode value of a non-character key in the keyboard event. |
ctrlKey | Returns whether or not the "CTRL" key was pressed when an event was triggered |
shiftKey | Returns whether or not the "SHIFT" key was pressed when an event was triggered |
altKey | Returns whether or not the "ALT" key was pressed when an event was triggered |
metaKey | Returns whether or not the "meta" key was pressed when an event was triggered |
KEY_PRESS
String
public
static
[static] Defines the value of the type property of a keypress event object.
This event has the following properties:
Property | Value |
---|---|
type | Returns the name of the event |
keyCode | Returns the Unicode value of a non-character key in the keyboard event. |
ctrlKey | Returns whether or not the "CTRL" key was pressed when an event was triggered |
shiftKey | Returns whether or not the "SHIFT" key was pressed when an event was triggered |
altKey | Returns whether or not the "ALT" key was pressed when an event was triggered |
metaKey | Returns whether or not the "meta" key was pressed when an event was triggered |
KEY_UP
String
public
static
[static] Defines the value of the type property of a keyup event object.
This event has the following properties:
Property | Value |
---|---|
type | Returns the name of the event |
keyCode | Returns the Unicode value of a non-character key in the keyboard event. |
ctrlKey | Returns whether or not the "CTRL" key was pressed when an event was triggered |
shiftKey | Returns whether or not the "SHIFT" key was pressed when an event was triggered |
altKey | Returns whether or not the "ALT" key was pressed when an event was triggered |
metaKey | Returns whether or not the "meta" key was pressed when an event was triggered |