Apache flex 将textarea的宽度设置为Flex 2中输入的文本
如何将文本区域宽度设置为在Flex中输入的文本长度?这里,我们可以根据文本的字体大小动态计算文本区域的宽度 如下Apache flex 将textarea的宽度设置为Flex 2中输入的文本,apache-flex,flex2,Apache Flex,Flex2,如何将文本区域宽度设置为在Flex中输入的文本长度?这里,我们可以根据文本的字体大小动态计算文本区域的宽度 如下 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
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)" />