Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Open specific dir using AIR?

Guest
Sep 14, 2013 Sep 14, 2013

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.

TOPICS
ActionScript
569
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Sep 16, 2013 Sep 16, 2013

Is it a case of Windows settings trumping the user prefs?

Yes.

Translate
Guru ,
Sep 16, 2013 Sep 16, 2013

Is it a case of Windows settings trumping the user prefs?

Yes.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 16, 2013 Sep 16, 2013
LATEST

Damn you to hell Windows. Cheers mate!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines