SelfResizeEditor.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:TextArea id="blockId" preinitialize="init()" width="500" height="50"
change="onChange(event)" creationComplete="onComplete(event)" >
<mx:Script>
<![CDATA[
private function init():void {
blockId.text="Keep typing. The height of this textarea increase";
}
private function onComplete(event:Event):void {
setHeight();
}
private function onChange(event:Event):void {
trace("textHeight:"+blockId.textHeight);
setHeight();
}
private function setHeight():void {
var h:Number=blockId.textHeight+15;
if (h<50) {
h=50;
}
blockId.height=h;
}
]]>
</mx:Script>
</mx:TextArea>
</mx:Application>