How do you programmatically move the caret of a Flex TextArea to the end?

前端 未结 6 1312
眼角桃花
眼角桃花 2021-01-12 15:25

I\'m trying to move the caret in a Flex TextArea to the end after appending some text from my code. I\'ve looked through the reference documentation for TextArea and its und

6条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-12 16:20

    To set the caret at any position in a textArea all u need to do is

    textArea.setSelection(beginIndex, endIndex);

    if u set the beginIndex & endIndex to the same value (in your case textArea.text.length) the caret will be placed at that positon. If you set it to different values, text in that range will be highlighted.

提交回复
热议问题