PDA

View Full Version : custom browseForOpen path


xwielder
01-16-2008, 11:41 AM
I have tried the following two (2) methods to get browseForOpen to open to a custom directory, but I just can't seem to get it to work. It's always opening to the logged in user's desktop directory. Is this something that's not allowed yet by Adobe, or am I just not coding it right?

Nope:

var OpenExFILE:File = new File();
function browseForExFile (event:Event):void
{
var testString:String = "C:\Documents and Settings\user\My Documents\test_folder";
OpenExFILE = OpenExFILE.resolvePath(testString);
var xmlFilter:FileFilter = new FileFilter("XML (*.xml)", "*.xml");
OpenExFILE.browseForOpen ("Open existing saved game file...", [xmlFilter]);
OpenExFILE.addEventListener (Event.SELECT, exFileSelected);
}


Nope:

var OpenExFILE:File = new File("C:\Documents and Settings\user\My Documents\test_folder");
function browseForExFile (event:Event):void
{
var myFileString:String = (OpenExFILE.nativePath);
OpenExFILE = OpenExFILE.resolvePath(myFileString);
var xmlFilter:FileFilter = new FileFilter("XML (*.xml)", "*.xml");
OpenExFILE.browseForOpen ("Open existing saved game file...", [xmlFilter]);
OpenExFILE.addEventListener (Event.SELECT, exFileSelected);
}

xwielder
01-16-2008, 01:23 PM
Got it.


var OpenExFILE:File = new File();
function browseForExFile (event:Event):void
{
var testString:String = "C:\\Documents and Settings\\user\\My Documents\\test_folder";
OpenExFILE = OpenExFILE.resolvePath(testString);
var xmlFilter:FileFilter = new FileFilter("XML (*.xml)", "*.xml");
OpenExFILE.browseForOpen ("Open existing saved game file...", [xmlFilter]);
OpenExFILE.addEventListener (Event.SELECT, exFileSelected);
}