The dataprovider ususally doesn't contain displayObjects, but rather
just data like the paths.  The image renderer will then use the data
items to figure out what to load.  You may also need labelField="source"
on the TileList, depending on what kind of data objects you use

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Claudio M. E. Bastos Iorio
Sent: Saturday, August 23, 2008 2:02 AM
To: [email protected]
Subject: [flexcoders] itemrender - tilelist - Image - AIR

 

Hi, I'm trying to retrieve a directory (AIR) with only images in it,
then display a thumbnail for each file using a tilelist. But, I wonder
why this code doesn't work:

 

private function OnInit():void{

      var file:File = File.applicationStorageDirectory;                 

      file.addEventListener(FileListEvent.DIRECTORY_LISTING, handleDIR);

      file.getDirectoryListingAsync();

}

            

[Bindable]

private var arrImage:Array = new Array();

            

private function handleDIR(event:FileListEvent):void{

      for each(var afile:File in event.files){

            if(afile.extension == 'jpg'){

                  var aImg:Image = new Image();

                  aImg.source = afile.nativePath;

                  arrImage.push(aImg);

            }     

      }

}

 

And the Tilelist control:

<mx:TileList id="displayimg" dataProvider="{arrImage}"
itemRenderer="mx.controls.Image" width="100%"
height="100%"></mx:TileList>

 

 

Any idea? Thanks in advance.

 

_____________________________________________

Claudio M. E. Bastos Iorio

http://www.blumer.com.ar <http://www.blumer.com.ar/> 

 

 

Reply via email to