/ Published in: ActionScript 3
                    
                                        
Display all files in a folder
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
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);
}
}
URL: http://www.destroyyourcomputer.com
Comments
 Subscribe to comments
                    Subscribe to comments
                
                