Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 underlying TextField but it appears there is no method provided to handle this.

One approach I've tried is to set focus to the text area and dispatch a KeyUp KeyboardEvent with the event's key code set to the "End" key, but this doesn't work.

Any ideas on how to do this?

Thanks.

like image 819
Akinwale Avatar asked Feb 02 '09 07:02

Akinwale


1 Answers

Try this

textArea.selectionBeginIndex = textArea.length;
textArea.selectionEndIndex = textArea.length;
like image 62
Chetan S Avatar answered Sep 27 '22 18:09

Chetan S