0

Ok I took some time and figured out to my surprise. and unfortunately I couldn't just use standard arrow keys. Im making a simulator of a label maker and it has to work to the letter, arrow keys, and everthing.

var boop = textSelect.text.length;
var snoop = boop;
bbbutton.addEventListener(MouseEvent.CLICK, backBtns);

function backBtns(event:MouseEvent):void
{


    snoop -=  1;
    stage.focus = textSelect;

    textSelect.setSelection( snoop,snoop);
}
4

1 回答 1

0

You can accomplish this by using a textField's caretIndex property.

Assuming textSelect is a TextInput component, if it's a textField, just remove the .textField property from the lines below.

//this gets the current caret position, and subtracts one (if not already at 0)
var pos:int = textSelect.textField.caretIndex > 0 ? textSelect.textField.caretIndex - 1 : 0;

//this sets the selection to adjusted caret postion
textSelect.setSelection(pos,pos);
于 2013-05-07T17:22:50.573 回答