Twitter <%=Resources.labels.subscribe %>

Flex 3 Expanding/ Collapsing TextArea

  • The following is a simple example showing how to create a TextArea component in your Flex application that expands as the user types text into it. Basically what you need to use is the TextArea's textHeight property, and set it's value to the height property of the TextArea in the controls change event. The assignment must happen in the TextArea's change event.

    Binding it directly does not work:

    <mx:TextArea id="myText" wordWrap="true" width="350"

    height="{myText.textHeight}"verticalScrollPolicy="off"

    borderStyle="none" />

    Instead use the change event:

    <mx:TextArea id="myText" wordWrap="true" width="350"

    change="{myText.height = myText.textHeight + 10;}" "verticalScrollPolicy="off"

    borderStyle="none" />

    A live example with view source enabled is available here.

    Tags:

    Permalink |

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading


Intro

My name is Brent Lamborn. I´m 35 years old and I live in Nebraska. I've been coding with the .NET Framework since 2003. I'm a former Marine and I have 5 boys.


View Brent Lamborn's LinkedIn profileView Brent Lamborn's profile

Sponsored By

Categories

Tag Cloud

Blog Roll