I am trying to move the cursor to Flex TextArea to the end after adding some text from my code. I looked through the reference documentation for TextArea and its underlying TextField, but there seems to be no method for this.
One approach I tried is to set focus to the text area and send the KeyUp KeyboardEvent with the key code event set to the Finish key, but that doesn't work.
Any ideas on how to do this?
Thanks.
try it
textArea.selectionBeginIndex = textArea.length; textArea.selectionEndIndex = textArea.length;
, Spark , Flex 4.5, selectRange(anchorIndex, activeIndex)
selectRange(anchorIndex, activeIndex)
, , ,
textArea.setSelection(beginIndex, endIndex);
u beginIndex endIndex ( textArea.text.length) positon. , .
, textarea
verticalScrollPosition : Number textArea.verticalScrollPosition(i);
@Paul Stewart verticalScrollPosition - , , , :
var newPosition:NUmber = 1; textArea.verticalScrollPosition = newPosition;
The advantage of using this element over selectBeginIndex / selectionEndIndex is that you do not need to install foucus.
Just add the following code after adding text to TextArea:
textArea.verticalScrollPosition = textArea.maxVerticalScrollPosition;