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

LTextEvent Class

Available since 1.9.0

An object dispatches a LTextEvent object when a user enters text in a text field or clicks a hyperlink in an HTML-enabled text field. There are two types of text events: LTextEvent.TEXT_INPUT and TextEvent.WIND_COMPLETE.

Constructor

LTextEvent

() public

Defined in events/LTextEvent.js:1

Available since 1.9.0

Item Index

Properties

Properties

TEXT_INPUT

String public static

Defined in events/LTextEvent.js:9

Available since 1.9.0

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

This event has the following properties:

PropertyValue
currentTargetThe object that is actively processing the Event object with an event listener.
targetIn this Event, Equivalent to currentTarget.
eventTypeThe type of the event.
keyCodeReturns the Unicode value of a non-character key in the keyboard event.
preventDefault()To cancel the event if it is cancelable

Example:

LInit(50, "legend", 800, 480, main);
function main () {
    LGlobal.setDebug(true);
    var theTextField = new LTextField();
    theTextField.x = 20;
    theTextField.y = 20;
    theTextField.setType(LTextFieldType.INPUT);
    addChild(theTextField);
    theTextField.addEventListener(LTextEvent.TEXT_INPUT, textinput);
}
function textinput(event){
    trace("event.keyCode=" + event.keyCode);
}

WIND_COMPLETE

String public static

Defined in events/LTextEvent.js:42

Available since 1.9.0

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

This event has the following properties:

PropertyValue
currentTargetThe object that is actively processing the Event object with an event listener.
targetIn this Event, Equivalent to currentTarget.

Example:

LInit(50, "legend", 800, 480, main);
function main () {
    LGlobal.setDebug(true);
    var theTextField = new LTextField();
    theTextField.x = 20;
    theTextField.y = 20;
    addChild(theTextField);
    theTextField.text = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    theTextField.speed = 2;
    theTextField.addEventListener(LTextEvent.WIND_COMPLETE, windComplete);
    theTextField.wind();
}
function windComplete(event){
    trace("windComplete","event.currentTarget = " + event.currentTarget);
}