LTextEvent Class
用户在文本字段中输入文本或在启用 HTML 的文本字段中单击超链接时,对象将调度 LTextEvent 对象。有两种类型的文本事件:LTextEvent.TEXT_INPUT 和 LTextEvent.WIND_COMPLETE。
Constructor
LTextEvent
()
public
Item Index
Properties
- TEXT_INPUT static
- WIND_COMPLETE static
Properties
TEXT_INPUT
String
public
static
[静态] 定义 textInput 事件对象的 type 属性值。
此事件具有以下属性:
属性 | 值 |
---|---|
currentTarget | 当前正在使用某个事件侦听器处理 Event 对象的对象。 |
target | 在此事件中等同于currentTarget。 |
eventType | 返回当前 Event 对象表示的事件的名称。 |
keyCode | 该属性声明了被敲击的键生成的 Unicode 字符码。 |
preventDefault() | 取消事件的默认动作。 |
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
[静态] 定义 textInput 事件对象的 type 属性值。
此事件具有以下属性:
属性 | 值 |
---|---|
currentTarget | 当前正在使用某个事件侦听器处理 Event 对象的对象。 |
target | 在此事件中等同于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);
}