Flex TextArea custom component which has auto height feature based on the content height.
It extends the TextArea component & updates the height based on the scroller content height.
package utils
{
import spark.components.TextArea;
public class TextAreaAutoHeight extends TextArea
{
public function TextAreaAutoHeight()
{
super();
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList( unscaledWidth, unscaledHeight );
this.height = scroller.viewport.contentHeight + 2 ;
if( this.height < minHeight )
this.height = minHeight;
if( this.height > maxHeight )
this.height = maxHeight;
}
}
}
No comments:
Post a Comment