I want to create a text box with a fixed width that will fit itself to its current text. So I went ahead and wrote this simple application:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="load();">
<mx:Script>
<![CDATA[
private function load():void {
text1.height = text1.textHeight;
}
]]>
</mx:Script>
<mx:TextArea id="text1" x="10" y="10" width="352" height="196" wordWrap="true" text="Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test"/>
</mx:Application>
Alas, the height of textHeight
is twice the height I needed.
How come? and how can it be fixed?