I have an input TextField and there is a KeyboardEvent.KEY_DOWN listener on the listener to listen to the Keyboard.ENTER event. An event listener adds the entered text to an array or something else, and then clears the TextField. The problem is that when the Enter key event is triggered and the value "Text" is set to "", it leaves the carriage return to the TextField and the cursor located on the second line. WTF? I have encoded AS2 and AS3 for a long time and have never encountered this before. Am I losing my mind? Please help people! :-)
Example:
var myTextArray:Array = new Array();
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
function onKeyDown(e:KeyboardEvent):void{
if(e.keyCode == Keyboard.ENTER){
if(_inputText.text != null){
myTextArray.push(_inputText.text);
}
_inputText.text = "";
}
}