Copy link to clipboard
Copied
Hi
Is there a way to force which dir is initially displayed when using browseForDirectory?
Currently I use browseForDirectory so the user can choose a dir of files to be processed.
After the process is done, I save the nativePath of the dir into the user's prefs file, with the idea that next time around, I can load the pref data, and have the same dir display as default when they browse, at which point they can use that dir or browse for a new one.
I can't get the dialog to open to that user dir though.
Here's some code, where I'm actually forcing the dir for testing. But each time the dialog opens up to the last dir that Windows thinks the user used (which is true, however this is one of three user dirs I need to save in prefs, so the dialog is currently incorrectly opening one of the other dirs):
// stripped down version for forum:
private var d1:File = File.desktopDirectory;
private function browseForSongs(event:Event):void
{
_model.userDir = "D:/projectTest/dir1"; //test of a nativePath saved from last successful dir open
if ( _model.userDir !='' || _model.userDir != null)
{
d1 = d1.resolvePath(_model.userDir);
}
d1.browseForDirectory("Select your directory");
d1.addEventListener(Event.SELECT, readSelectedDirs,false,0,true);
d1.addEventListener(Event.CANCEL, cancelImportFiles,false,0,true);
}
I've also played around adding various combinations of the following into the mix...
d1.nativePath = "D:/projectTest/dir1";
d1 = new File();
Anything obvious I'm doing wrong? Is it a case of Windows settings trumping the user prefs?
Thanks for taking a look.
Is it a case of Windows settings trumping the user prefs?
Yes.
Copy link to clipboard
Copied
Is it a case of Windows settings trumping the user prefs?
Yes.
Copy link to clipboard
Copied
Damn you to hell Windows. Cheers mate!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now