Hi guys,
The point of my question looks quite easy but I can’t find an answer for it. I have an input textfield (or textarea) and after pressing ENTER key, the text should be sent. That works without problems, the problem is that with multiline textfield pressing ENTER puts a linebreak, so the cursor jumps to the “2nd line” in the textfield. Does anybody know how to avoid this? The code I am using so far:
var keySend:Object = new Object();
function onEnterDown() {
if (Key.isDown(Key.ENTER)) {
chat_so.data.textmessage = message_ta.text+newline;
chat_so.data.username = username;
chat_ta.text += username+": "+message_ta.text+newline;
message_ta.text = "";
}
}
keySend.onKeyDown = onEnterDown;
message_ta.onSetFocus = function(){
Key.addListener(keySend);
}
message_ta.onKillFocus = function(){
Key.removeListener(keySend);
}
Thanks a lot for any advice!
P.