开发者

Adobe AIR 2 not detect enter inside TLF TextField

开发者 https://www.devze.com 2023-03-23 08:46 出处:网络
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

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

精彩评论

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

关注公众号