tags:

views:

512

answers:

2

I have a mx:Text tag with some text I would like to display in a list. The code is below.

<mx:List id="projectList"
     width="100%"
     height="100%"
          dataProvider="{project.projectRequirements}"
          borderThickness="0">
        <mx:itemRenderer>
         <mx:Component>
          <mx:HBox height="100%"
             minHeight="20"
             paddingBottom="0"
             paddingLeft="0"
             paddingRight="0"
             paddingTop="0"
             width="100%"
             horizontalScrollPolicy="off"
             verticalScrollPolicy="off">
           <mx:Text width="100%"
              fontSize="12"
              text="{data.requirement.requirementText}"/>
          </mx:HBox>
         </mx:Component>
        </mx:itemRenderer>
       </mx:List>

If I manually set the height of the mx:HBox to something i know will allow for several lines, then the text will wrap. I was really hoping each component in the list could be a different height, determined by the amount of text. Some of the text is 1 line, some is 4 or 5.

+1  A: 

List has a variableRowHeight property that is set to false by default. Set it to true, then make sure your renderer does NOT have a height specified (so it is measured instead).

You don't need to wrap your component in an HBox, it can extend Text directly.

Sean Clark Hess
A: 

Did you ever get an answer to your question?

Shef