Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex 将textarea的宽度设置为Flex 2中输入的文本_Apache Flex_Flex2 - Fatal编程技术网

Apache flex 将textarea的宽度设置为Flex 2中输入的文本

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

如何将文本区域宽度设置为在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="200" fontSize="25" change="onChange(event)" />