text area auto height

rakesh16d
rakesh16d used Ask the Experts™
on
hi experts, i have a list in which i am rendering text area, text length is variable- can range from 2 lines to 10 lines. how do i auto resize the height.. i have tried most of the things from google  but its not working as required. when i render and update the list. it creating scroll bars.

please help
<mx:List id = "rendererList"
		dataProvider="{dataXML.entry}">
		<mx:itemRenderer>
			<mx:Component>
				<mx:TextArea  width="100%" height="100"/>
			</mx:Component>
		</mx:itemRenderer>
	</mx:List>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
	<mx:Script>
		<![CDATA[
			import mx.controls.TextArea;
			
			[Bindable] private var dataXML:XML = <e>
			<entry>1</entry>
			<entry>78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587 78468764587</entry>
			<entry>3</entry>
			</e>;
			
			public function doChange(e:Event):void
			{
				e.currentTarget.validateNow();
				e.currentTarget.height=(e.currentTarget as TextArea).textHeight + 10;
				trace( (e.currentTarget as TextArea).textHeight);
			}			
		]]>
	</mx:Script>
	<mx:List id = "rendererList" variableRowHeight="true"
                dataProvider="{dataXML.entry}">
                <mx:itemRenderer>
                        <mx:Component>
                               <mx:TextArea  width="100%" height="100" dataChange="outerDocument.doChange(event)"/>
                        </mx:Component>
                </mx:itemRenderer>
    </mx:List>	
</mx:Application>

Open in new window

Commented:
Is there any source file to go with this?


Thank you
Thomas

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial