How to control cursor position (carats) in TextInput in Flex 4.5

I need to process paragraphs and then convert them on the fly to the correct Unicode representation. For example, when a user enters:

Sx

My application should replace it:

Ŝ

Now I was able to make a replacement without any problems. The problem is that after I made the replacement, the cursor will move to the beginning of the text field, and not to the end. Since I am trying to update user text on the fly, this obvious is not working.

How can I get it so that as soon as I replace the text in the TextInput field, the cursor is on the right side, and not on the left?

+5
source share
4 answers

Found a solution.

, , , , :

textInput.appendText()

, - :)

+5

setSelection - ,

textInput.setSelection(textInput.text.length, textInput.text.length);

TextInput.selectionAnchorPosition TextInput.selectionAnchorPosition

+2

SO: Flex TextArea ?

textArea, ( ):

textArea.selectionBeginIndex = textArea.length;
textArea.selectionEndIndex = textArea.length;
+1

, Spark textInput, :

textInput.selectRange(textInput.text.length, textInput.text.length);
0

All Articles