• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 762
  • Last Modified:

flex textArea vertical alignement

in Flex4.5
I found that :
http://blog.flexexamples.com/2010/01/18/creating-a-vertically-auto-resizing-spark-textarea-control-in-flex-4/

It works in flex4 but not in Flex4.5


I think I could solve my problem with
heightInLines="{NaN}"

and istead on NaN, put the textarea number of lines: But I do not know how to get these number of lines !

regards





<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/01/18/creating-a-vertically-auto-resizing-spark-textarea-control-in-flex-4/ -->
<s:Application name="Spark_TextArea_heightInLines_NaN_test"
			   xmlns:fx="http://ns.adobe.com/mxml/2009"
			   xmlns:s="library://ns.adobe.com/flex/spark"
			   xmlns:mx="library://ns.adobe.com/flex/mx" viewSourceURL="srcview/index.html">
	
	<s:TextArea id="ta"
				heightInLines="{NaN}"
				horizontalCenter="0" verticalCenter="0" />
	
</s:Application>

Open in new window

0
yarekGmail
Asked:
yarekGmail
1 Solution
 
dgofmanCommented:
try this

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/01/18/creating-a-vertically-auto-resizing-spark-textarea-control-in-flex-4/ -->
<s:Application name="Spark_TextArea_heightInLines_NaN_test"
			   xmlns:fx="http://ns.adobe.com/mxml/2009"
			   xmlns:s="library://ns.adobe.com/flex/spark"
			   xmlns:mx="library://ns.adobe.com/flex/mx" viewSourceURL="srcview/index.html">
	
	<!--s:TextArea id="ta"
				heightInLines="{NaN}"
				horizontalCenter="0" verticalCenter="0" /-->
	
	<s:TextArea id="ta" 
				horizontalCenter="0" verticalCenter="0"
				updateComplete="ta.heightInLines = NaN;"/>
	
</s:Application>

Open in new window

0
 
puzzle-itCommented:
You can retrieve number of lines inside text area this way:
ta.textFlow.flowComposer.numLines

Open in new window


So try this code:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/01/18/creating-a-vertically-auto-resizing-spark-textarea-control-in-flex-4/ -->
<s:Application name="Spark_TextArea_heightInLines_NaN_test"
			   xmlns:fx="http://ns.adobe.com/mxml/2009"
			   xmlns:s="library://ns.adobe.com/flex/spark"
			   xmlns:mx="library://ns.adobe.com/flex/mx" viewSourceURL="srcview/index.html">
			   
	<fx:Script>
		<![CDATA[
			private function onChange(event:flash.events.Event):void
			{
				ta.heightInLines = ta.textFlow.flowComposer.numLines;
			}
			
		]]>
	</fx:Script>
	
	<s:TextArea id="ta"
				heightInLines="1"
				change="onChange(event)"
				horizontalCenter="0" verticalCenter="0" />
	
</s:Application>

Open in new window

0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now