I have some flex3 code that uses a TextArea to select a line from a char index:
var tf:IUITextField=ta.mx_internal::getTextField();
var lineIndex:int= tf.getLineIndexOfChar(someCharIndex);
var lineCharIndex:int= tf.getLineOffset(lineIndex);
var lineLength:int= tf.getLineLength(lineIndex);
ta.setSelection(lineCharIndex, lineCharIndex+lineLength);
I’d like to upgrade this to flex4’s TextArea, but I’m not sure what the flex4 equivalents of the IUITextField methods are (getLineIndexOfChar, getLineOffset, getLineLength).
Can someone point me to some docs for these methods?
Here is a simple application which illustrates how to select text line with Spark
TextAreausing TLF and itsTextFlow:All that you need is located in
textFlow_selectionChangeHandler()method. After determining char position we extractedTextFlowLinefor this position and then selected it. To test this code just click somewhere in yourTextArea.Hope this helps!