I'm attempting to create a very simple item renderer for mx:List.  I've found 
that when the dataProvider is static, there are no problems with the custom 
item renderer.  However, when the dataProvider is dynamic, the height of the 
item renderer is not correct.  I've set variableRowHeight="true" for the List.  
I've also tried overriding the measure function and invaliding the size when a 
dataChange event is dispatched.  So far, I have a multi-line Text component 
with word wrap, but the height (determined by textHeight in the overriden 
measure) is way to large.

CommentRenderer.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"; width="100%">
    <mx:Script>
        <![CDATA[
            override protected function measure():void
            {
                super.measure();
                measuredHeight = comment.textHeight;
            }
        ]]>
    </mx:Script>
    <mx:LinkButton label="{data.commenter.name}"/>
    <mx:Text id="comment" width="100%" text="{data.comment}" 
dataChange="invalidateSize()"/>
</mx:VBox>


The mx:List definition:

<mx:List id="comments" itemRenderer="com.test.CommentRenderer" width="100%" 
height="100%"/>


I've looked over the ListItemRenderer, but have so far been unable to glean the 
magic sauce that makes the item renderer function correctly when the control 
recycles.  Can someone explain why my item renderer height is determined to be 
294 pixels, when the Text has only 3 lines (standard font)?  What am I missing 
here?

Reply via email to