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();
}
}
精彩评论