Search code examples
listapache-flexitemrendererflex-spark

Spark ItemRenderer not showing contents


I have a spark list component and a corresponding custom itemrenderer:

list component:

<s:List id="albumImagesList" itemRenderer="the.namespace.for.XYZImageRenderer" useVirtualLayout="false" width="400" height="160">
    <s:layout>
        <s:TileLayout requestedColumnCount="5"
                requestedRowCount="2"
                rowHeight="80"
                columnWidth="80"
                horizontalGap="0"
                verticalGap="0" />
    </s:layout>
</s:List>

item renderer:

<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                xmlns:s="library://ns.adobe.com/flex/spark" 
                xmlns:mx="library://ns.adobe.com/flex/mx"
                autoDrawBackground="true" width="100%" height="100%">
    <s:states>
        <s:State name="normal" />
    </s:states>

    <s:BitmapImage source="{data.image_path}" width="70" height="70" horizontalCenter="0" verticalCenter="0" />

</s:ItemRenderer>

It's all fine and dandy, the data gets populated correctly and I verified that the data.image_path property arrives safe and sound inside the itemrenderer.

My only problem is: the image is not displaying. I am not sure if it doesn't render at all or if it's just not visible somehow.

Does anyone see something at first glance? Am I doing something fundamentally wrong here? I worked with mx item renderers before and I never had so much trouble with those.


Solution

  • phew, ok got it fixed using this guy's approach: http://polygeek.com/2452_flex_extending-spark-bitmapimage

    maybe it's going to be of help for someone.

    cheers!