Catch enter key press in input text field in AS3
- by Jonathan Barbero
Hello,
I want to catch the enter key press when the user is filling an input text field in AS3.
I think I have to do something like this:
inputText.addEventListener(Event. ? , func);
function func(e:Event):void{
if(e. ? == "Enter"){
doSomething();
}
}
But I can't find the best way to do this.
By the way, the input text has a restriction:
inputText.restrict = "0-9";
Should I add the enter key to the restrictions?
inputText.restrict = "0-9\n";
Thanks in advance.