AutoresizeTextArea.as

Код AS3:
package com
{
import flash.events.Event;
import flash.text.TextFieldAutoSize;
import mx.controls.TextArea;
public class AutoresizeTextArea extends TextArea
{
public function AutoresizeTextArea()
{
super();
horizontalScrollPolicy = "off";
verticalScrollPolicy = "off";
this.addEventListener(Event.CHANGE, function(event:Event):void {
invalidateSize();
});
}
override protected function childrenCreated():void
{
this.textField.autoSize = TextFieldAutoSize.LEFT;
this.textField.wordWrap = false;
super.childrenCreated();
}
override protected function measure():void
{
super.measure();
measuredWidth = textField.width;
measuredHeight = textField.height;
}
}
}