Setting width of textarea to text being entered in Flex 2

65 views Asked by At

How to set the text area width to the length of the text being entered in Flex?

1

There are 1 answers

0
Rajendra On

here we may calculate the width of the text area dynamically on basis of font size of the text as follows

protected function onChange(event:TextOperationEvent):void
{

if(textBox.width <textBox.text.length*5)
textBox.width = textBox.text.length*5;
}
<s:TextArea id="textBox" height="200" width="200" fontSize="25" change="onChange(event)" />