Return to Snippet

Revision: 21758
at December 20, 2009 02:57 by allnatural

Initial Code
import mx.collections.ArrayCollection; 
import flash.filesystem.File;

//declare array collection 'listfiles' dataprovider for the list//			
private var listfiles:ArrayCollection=new ArrayCollection();

private function listdesktopfiles():void{

//point the file object 'desktop' to the desktop path//			

var desktop:File = File.desktopDirectory;
/* var desktop:File = File.desktopDirectory.resolvePath("Adobe AIR"); 
will direct the path to the subdirectory 'Adobe AIR' available on the desktop */

//getDirectoryListing() returns array of file objects from the file object pointer, desktop in this case//
var getfiles:Array = desktop.getDirectoryListing();

//Push all thi values to the Arraycollection to be diaplayed in the list//
for (var i:int = 0; i < getfiles.length; i++) { 			  	 			  
	listfiles.addItemAt((getfiles[i].nativePath), i);   

Initial URL

Initial Description
Display all files in a folder

Initial Title
Get all files from a folder

Initial Tags

Initial Language
ActionScript 3