Search code examples
flashairtlf

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.events.TextEvent;

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

Solution

  • 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();
        }
    }