I’m making a text box where the user can type in whatever they want, but they can press “Enter” to make a new line. I am using the following code to do this:
function text_box_enter_down(event:KeyboardEvent):void {
if (event.keyCode==13) {
if(stage.focus == text_box){
text_box.appendText("
");
}
}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, text_box_enter_down);
It works nicely, making a new line, but it does not move the cursor down to the new line. I’m looking for a way to do this.
Thanks!