简体   繁体   中英

Setting width of textarea to text being entered in Flex 2

如何将文本区域的宽度设置为在Flex中输入的文本的长度?

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)" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM