API Docs for: 最后更新日期:2014年8月25日
Google搜索   
Show:

LKeyboardEvent Class

Available since 1.0.0

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

Defined in events/LKeyboardEvent.js:1

Available since 1.0.0

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);
}

Item Index

Properties

Properties

KEY_DOWN

String public static

Defined in events/LKeyboardEvent.js:34

Available since 1.0.0

[static] Defines the value of the type property of a keydown event object.

This event has the following properties:

PropertyValue
typeReturns the name of the event
keyCodeReturns the Unicode value of a non-character key in the keyboard event.
ctrlKeyReturns whether or not the "CTRL" key was pressed when an event was triggered
shiftKeyReturns whether or not the "SHIFT" key was pressed when an event was triggered
altKeyReturns whether or not the "ALT" key was pressed when an event was triggered
metaKeyReturns whether or not the "meta" key was pressed when an event was triggered

KEY_PRESS

String public static

Defined in events/LKeyboardEvent.js:72

Available since 1.0.0

[static] Defines the value of the type property of a keypress event object.

This event has the following properties:

PropertyValue
typeReturns the name of the event
keyCodeReturns the Unicode value of a non-character key in the keyboard event.
ctrlKeyReturns whether or not the "CTRL" key was pressed when an event was triggered
shiftKeyReturns whether or not the "SHIFT" key was pressed when an event was triggered
altKeyReturns whether or not the "ALT" key was pressed when an event was triggered
metaKeyReturns whether or not the "meta" key was pressed when an event was triggered

KEY_UP

String public static

Defined in events/LKeyboardEvent.js:53

Available since 1.0.0

[static] Defines the value of the type property of a keyup event object.

This event has the following properties:

PropertyValue
typeReturns the name of the event
keyCodeReturns the Unicode value of a non-character key in the keyboard event.
ctrlKeyReturns whether or not the "CTRL" key was pressed when an event was triggered
shiftKeyReturns whether or not the "SHIFT" key was pressed when an event was triggered
altKeyReturns whether or not the "ALT" key was pressed when an event was triggered
metaKeyReturns whether or not the "meta" key was pressed when an event was triggered