PDA

View Full Version : Browse on the computer using air


adrian281990
12-10-2007, 07:27 PM
I wont to add a new panel to my air app. I wont this panel to contain the user computer tree(ex my computer, my documents, etc, like Microsoft Explorer, or on mac the Finder) I wont to let the user navigate with this panel when the user double clicks on a flv file to play that file or drag that file.
Please help, if can give me an example it will grate.
Thank you,
Adrian

adrian281990
12-10-2007, 07:28 PM
I wont to add a new panel to my air app. I wont this panel to contain the user computer tree(ex my computer, my documents, etc, like Microsoft Explorer, or on mac the Finder) I wont to let the user navigate with this panel when the user double clicks on a flv file to play that file or drag that file.
Please help, if can give me an example it will grate.
Thank you,
Adrian

xwielder
01-03-2008, 12:33 PM
// Represents a path to a file or directory.
import flash.filesystem.File;

// Used to open files for reading/writing.
import flash.filesystem.FileStream;

// Determines the capabilities available to the FileStream object once the file is opened,
// which include writing, reading, appending, and updating.
import flash.filesystem.FileMode;

// Variables
var OpenFILE:File = File.documentsDirectory;

// Listeners
myBrowseButton.addEventListener (MouseEvent.CLICK, browseForFile);

// Functions
function browseForFile (event:Event):void
{
var xmlFilter:FileFilter = new FileFilter("XML (*.xml)", "*.xml");
OpenFILE.browseForOpen ("Open the XML file", [xmlFilter]);
OpenFILE.addEventListener (Event.SELECT, fileSelected);
}

function fileSelected (event:Event):void
{
trace("Thank you, you've browsed for and selected a file");
}