Hi, I am extending the TextArea class (call it MyTextArea) and want to get information about the text in the textField. I wait for the CREATION_COMPLETE event before accessing the textField, but the textField.getLineIndexOfChar() method returns -1 directly after an update of this.text. Is there an event to listen to that will ensure the text has been updated and rendered so that getLineIndexOfChar() and other similar methods will give the expected results? I include my code below.
By the way, I have a click listener and after the SWF loads and I click on the TextArea, I get the expected values of getLineIndexOfChar(). Thanks for your help, James public class MyTextArea extends TextArea { public function MyTextArea():void { super(); // have to wait until CREATION_COMPLETE fires otherwise // this.textField is null addEventListener(FlexEvent.CREATION_COMPLETE, onCreationComplete); } private function onCreationComplete(e:FlexEvent):void { // looks like the text gets set but info about the text // layout in the TextField is not yet known... this.text = 'this is a long string\n of multiline text'; // these both return -1 trace(this.textField.getLineIndexOfChar(1)); trace(this.textField.getLineIndexOfChar(25)); } }