开发者

Adobe AIR 2 not detect enter inside TLF TextField

This code work in flash, but when i try run using adobe air 2, the enter key is not detected, but instead ctrl+enter work. how to get this work? Ty in advance

txtTLF is TLF TEXT EDITABLE

import flash.eve开发者_如何学Pythonnts.TextEvent;

txtTLF.addEventListener(TextEvent.TEXT_INPUT, teclado);
function teclado(e:TextEvent):void{
    if(e.text == String.fromCharCode(13)){
        e.preventDefault();
        code();
    }
}


I find the answer, DONT FORGET THE TRUE, the code is:

txtTLF.addEventListener(KeyboardEvent.KEY_DOWN, teclado, true);
function teclado(e:KeyboardEvent):void{
    if(e.keyCode == 13){
        e.preventDefault();
        code();
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜