How to set variable size for List control item in Flex?

Posted by joejax on Stack Overflow See other posts from Stack Overflow or by joejax
Published on 2010-06-17T06:47:00Z Indexed on 2010/06/17 6:53 UTC
Read the original article Hit count: 232

Filed under:
|
|
|

The following code display a list of comments using List control. The item height set to a fixed value (150), so it seems working: if the content is too long, the scrollbar shows...

However, what I really want is not to set the height but let it to change according to the content size. Is there any way to accomplish this?

        <mx:List id="commentList" width="100%" dataProvider="{commentSet.commentArrayColl}"
            rowCount="{commentSet.commentArrayColl.length}" >
            <mx:itemRenderer>
                <mx:Component>
                    <mx:VBox width="100%" height="150" >
                        <mx:Text text="{data.commentContent}" />
                        <mx:Text text="{data.username} ({data.modified})"/>
                    </mx:VBox>
                </mx:Component>
            </mx:itemRenderer>
        </mx:List> 

© Stack Overflow or respective owner

Related posts about flex

Related posts about list