0 Replies Latest reply on Sep 18, 2008 12:06 PM by TonyInBloomington

    Dynamically add an in memory Bitmap to a List

    TonyInBloomington
      I'm trying to dynamically add an in memory Bitmap to a List control. I'm trying to create a thumbnail
      from a larger bmp image and display the thumbnail in the list. The thumbnail images are being created ok
      but the bitmaps are not displaying in the List control. The code I'm using is shown below. Apparently I can't
      use a collection of bitmaps in the List. Previously I had a collection of pathnames as strings that pointed to
      jpgs on disk and it displayed ok. Does anyone know how I can get the Bitmaps to display?

      <mx:List id="fileList" x="10"y="10" width="231" height="648" rowHeight="160" columnWidth="120 enabled="true"
      click="loadImage()" itemRenderer="mx.controls.Image" dataProvider="{myProvider}"></mx:List>
      ...
      public var anArray:Array = new Array();
      public var myProvider:ArrayCollection = new ArrayCollection(anArray);
      ...
      var thumbnail:Bitmap = new Bitmap(new BitmapData(thumbSize,thumbSize,true,0));
      thumbnail.bitmapData.draw(bmp,matrix);
      myProvider.addItem(thumbnail);