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.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

 

Related posts

What say you?


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Subscribe

Recent comments

Tag Cloud

calendar

<<  November 2008  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567