0 Replies Latest reply on Mar 25, 2008 3:45 PM by flashharry!

    DataGrid Item Renderer loading duplicates after scroll

    flashharry!
      HI,

      I have a report that loads into a datagrid, these reports are about thumbnail images that are on a server.

      I have a datagrid item renderer that loads the thumb nails. When the grid first loads the first set of rows that are visible display the correct images. But after I scroll the new rows have images that are repeated and not the correct ones.

      ?xml version="1.0" encoding="utf-8"?>
      <HBox xmlns=" http://www.adobe.com/2006/mxml" horizontalScrollPolicy="off" verticalScrollPolicy="off" creationComplete="{init()}">

      <Script>
      <![CDATA[
      import mx.controls.Image;
      [Bindable]
      [Embed(source="/images/folderBlack.png")]
      private var folderIcon:Class;


      private function suffix(url:String):String {
      var i:Number;
      if ((i = url.lastIndexOf(".")) > -1) {
      url = url.substr(i+1);
      }
      return url;
      }
      private function init():void {
      var fileSuffix:String = new String;
      fileSuffix = '';
      fileSuffix = suffix(data.filename);
      var staticPortalImage:String = new String;
      staticPortalImage = '/PULLIMAGE.php?type=small&id=' + data.FileID +
      '&path=' + data.filename + '&server=MTI3LjAuMC4x&siteurl=L0F1dGhNb2R1bGU=';
      var thumbNailImage:Image = new Image();
      thumbNailImage.height = 80;
      switch(fileSuffix){
      case 'jpg':
      thumbNailImage.source = staticPortalImage;
      break;
      }
      imageContainer.addChild(thumbNailImage);
      texttest.text = fileSuffix;
      }

      ]]>
      </Script>
      <Text id="texttest" />
      <HBox id="imageContainer" height="80" />
      </HBox>