Flex List ItemRenderer with image looses BitmapData when scrolling

Posted by Dominik on Stack Overflow See other posts from Stack Overflow or by Dominik
Published on 2010-05-20T18:35:22Z Indexed on 2010/05/20 18:50 UTC
Read the original article Hit count: 347

Filed under:
|
|
|
|

Hi i have a mx:List with a DataProvider. This data Provider is a ArrayCollection if FotoItems

public class FotoItem extends EventDispatcher
{
    [Bindable]
    public var data:Bitmap;
    [Bindable]
    public var id:int;
    [Bindable]
    public var duration:Number;

    public function FotoItem(data:Bitmap, id:int, duration:Number, target:IEventDispatcher=null)
    {
        super(target);
        this.data = data;
        this.id = id;
        this.duration = duration;
    }
}

my itemRenderer looks like this:

<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009" 
            xmlns:s="library://ns.adobe.com/flex/spark" 
            xmlns:mx="library://ns.adobe.com/flex/mx" >
<fx:Script>
    <![CDATA[
        import mx.collections.ArrayCollection;
    ]]>
</fx:Script>

<s:Label text="index"/>
<mx:Image source="{data.data}" maxHeight="100" maxWidth="100"/>
<s:Label text="Duration: {data.duration}ms"/>
<s:Label text="ID: {data.id}"/>

</mx:VBox>

Now when i am scrolling then all images that leave the screen disappear :( When i take a look at the arrayCollection every item's BitmapData is null.

Why is this the case?

© Stack Overflow or respective owner

Related posts about flex

Related posts about list