PDA

View Full Version : AS3 and Air to list directories.


4dartist
01-24-2010, 09:19 PM
I'm very new to flash and AS3. I've been learning a lot the last couple days, and basically am trying to build a desktop program that has two video players. The players have a list under them of some sort so I can pick between 80 organized video files. Enabling the user to compair any two videos.

I plan to organize the videos by putting them in an FLV folder right next to the main flash file. So under the FLV folder would be a few subfolders containing all the videos.

I just cannot wrap my brain around Air. From all the help docs online, I cannot figure out how to simply read the folders in a certain directory and put them in a variable or list. That way I can put them in a pull down component.

I'm using CS3 and Air 1.0. I installed the lastest Air for CS3 on the Mac. It says 1.5 in the documentation of the files that came with the install, but CS3 still reports it's using 1.0 runtime.

Ok, any advice or direction on a tutorial or code would help so much.

figuring out the right syntax to just locate my flash documents folder, go into the FLV folder, grab all the subfolders and put them into a dataprovider or something.

Ben

NoobsArePeople2
01-25-2010, 05:01 PM
Listing files in a directory:



// Reads the folder "myDir" on the user's desktop
// You can make this user selectable by using
// File.browseForDirectory("Choose a Directory") and
// wiring up the necessary event listeners.
var dir:File = File.desktopDirectory.resolvePath("myDir");

// Get everything inside the dir. This includes other dirs.
// files will be an Array of File objects.
// You can filter between dirs and files based on the File.isDirectory property.
var files:Array = dir.getDirectoryListing();

// Loop over files array and get what you need.