5 Replies Latest reply on Jan 18, 2011 10:39 PM by Flex harUI

    Need to set image width and height in itemRenderer for list virtualization

    FredericCox Level 1



      By default the spark list supports virtualization (which is cool) but I ran into a problem with the list creating all itemrenderers even when useVirtualization is set to true. After some debugging and samples I made it became clear that it did not work without setting the width and height on the image inside the itemRenderer.


      Is this a bug or expected behaviour?


      <?xml version="1.0" encoding="utf-8"?>
      <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                          autoDrawBackground="true" useHandCursor="true" mouseChildren="false" creationComplete="itemrenderer1_creationCompleteHandler(event)">
                     import mx.events.FlexEvent;
                     protected function itemrenderer1_creationCompleteHandler(event:FlexEvent):void
                          trace("created " + this.data);
           <!-- Without setting a specific height it will not work in virtualization! -->
           <mx:Image height="187" width="280" source="{data}" />