tags:

views:

751

answers:

4

I have a Tree object in my Flex code. It's width is 100%, and it is contained by a Panel with width=200. I am using a custom itemrenderer that extends TreeItemRenderer.

I need the text in each node to word wrap if it's too big (as happens often). I have tried

label.wordWrap = true;

in my item renderer without any luck. Any other suggestions?

A: 

What is the height that is set on the label? Is there enough room for the text to go vertically?

CookieOfFortune
A: 

try setting the label width to a constant width. If your not able to do this because it needs to be dynamic then you need to override the update functions and set the width of the label then. The problem is the label hasn't calculated the actual 100% width at the time of rendering so it doesnt know it has to warp or not.

Shua
+1  A: 

If 'label' is an instance of the Label component, you won't be able to get it to wrap, no matter what you do, as the Label component doesn't support wrapping. Or, rather, is meant to be used only for single-line text.

If you are using a Label component, try using a Text component, instead. It's meant to display multi-line text.

Ross Henderson
A: 

Dont Use Label. Use ' mx:Text width=" 100%" ' ( Text with 100% width) and it will wrap on its own.

Saurabh