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

How to open a folder using Actionscript 3.0

Enthusiast ,
Sep 19, 2009 Sep 19, 2009

Hi,

I have been trying for about a day to get this to work, but nothing seems to, so i'm finally going to ask.

So far, code wise, i have this:

     open_btn.addEventListener(MouseEvent.CLICK, OpenButtonHandler);

     function OpenButtonHandler(event:MouseEvent):void

    {  }

From there, what code gets flash to literally open up a folder such as My Documents? The end use of this code will be for a CD, whereby the flash .exe file will call up folders from the disc through clicking buttons. Also, please make me awear of under what situations the code may not work. At the moment, i am writting the .exe file to the desktop, and trying to open a folder on my desktop through the application.

Often times, everything i have tried so far, either causes Syntax Errors or no errors, but just doesn't work.

Thanks,

Ricky

EDIT:

Primarily in Windows, but if you know the Mac way too, that could be useful.

TOPICS
ActionScript
6.0K
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
Community Expert ,
Sep 19, 2009 Sep 19, 2009

you can use the filereference class (and its browse() method) to open a file-browse dialogue box.  you can't direct which folder this will point to and, if the user selects  file, you can't detect which folder that file was in -  unless you use air.

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
Enthusiast ,
Sep 19, 2009 Sep 19, 2009

Is that the same for bringing up a specified folder?

My goal is to make one of the CD's that often come with tutorial books, that bring up a flash menu when inserted, and you click on a button, and it will bring up a folder located on the disc. Is this the same problem?

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
Community Expert ,
Sep 19, 2009 Sep 19, 2009

yes.  just supply directions to the user to navigate to their cd-drive and direct them to the desired folder.

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
Enthusiast ,
Sep 19, 2009 Sep 19, 2009

Is there no way to get buttons to open up explorer folders specified? It seems people are managing it somehow, but i can't do it. Others aprantly can do it using this code:

     on(release){
      getURL("flash",_black);
      }

, but that's actionscript 2, not 3 which i am using. Surely actionscript 3 can do this and possibly even better seeing as it is a higher version?

I also found another bit of code that was like this:

     fscommand("exec","explorer\dirname");

,but again that didnt work. However, in another way it did because flash reported no errors when it was run, but nothing happened when the button was clicked.

The only other thing i tried was this:

     var request:URLRequest=new URLRequest("C:\\");
    navigateToURL(request);

The problem with that was that it tried to open the internet as expected unfortinatly, not windows explorer to open the folder C:\\.

Directing users to the appropiate locations on the disk wasn't really what i needed thanks for the suggestion though.

EDIT:

That last idea worked, sorry, but it opened in the default web-browser instead of using explorer, so i'm half way there. Is it possible to tell it what application to use to open the directory, so that way i can specify explorer?

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
Enthusiast ,
Sep 19, 2009 Sep 19, 2009
LATEST

Done it, but probably not the right way. The actionscript is told to run through a .bat file to open the path directory, and it all works. I only have one last question that i'm not 100% sure i can get an answer to here, but i'll give it a shot and will be very appreciative if anyone can help now. When the .bat file runs, the DOS window pops up for a split second before explorer starts. Now, aprantly Windows ME can stop this by telling the DOS window to be minimized when it runs, but i am on XP. Does anyone know how to stop the DOS window poping up at least how to hide it?

Thanks very much for the help!

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