6 Replies Latest reply on Aug 5, 2006 12:55 PM by abeall

    probably basic flash?

    kenshamrock
      Basically i have a download button and when its clicked on i want the 'save as' screen to pop up, hows is this done in flash?

      i also have an email button where i want an automatic email screen to pop up just as what happens if u use the mailto code in html.

      it may be basic, im not sure, but im a flash beginner.

      thanks in advance
        • 1. Re: probably basic flash?
          kglad Adobe Community Professional & MVP
          1. if you're using flash 8, check the filereference class.

          2. getURL("mailto:you@somedomain.com");
          • 2. Re: probably basic flash?
            abeall Level 3
            As kglad said, if you use Flash 8(or more specifcally, publish for Flash Player 8 only), then you can use the FileReference class. It's not exactly what I'd call "basic" but it is fairly straigh forward. The bare bones are:

            var fileRef = new FileReference();
            fileRef.download(" http://yourdomain/yourfile.bla");

            However, there is alot of other code that could be added to handle all the different situations that occur, such as if the dialog fails to open, or a user clicks cancel, ect.

            And, if you are *not* using Flash 8, then doing this is anything but straight forward. In fact, it's impossible to directly call a download/upload action from Flash in previous versions.
            • 3. Re: probably basic flash?
              Level 7
              > In fact, it's impossible to directly call a download/upload action
              > from Flash in previous versions.

              Sure, but depending on what kind of file you are trying to download you can
              still get the rsults you need - if it's a ZIP file, a simple

              getURL( http://www.mydomain.com/myZipFile.zip);

              will do it.



              --
              -------------------------------
              Remove '_spamkiller_' to mail
              -------------------------------


              • 4. Re: probably basic flash?
                abeall Level 3
                > Sure, but depending on what kind of file you are trying to download you can
                > still get the rsults you need - if it's a ZIP file, a simple

                > getURL( http://www.mydomain.com/myZipFile.zip);

                > will do it.

                You're right, for some reason I was thinking that even in that case it requires a new window to be opened, but now that you mention it, it doesn't, does it? It only opens a browser if the SWF is not already in a browser(in the case of a projector, for instnace).

                Thanks.
                • 5. Re: probably basic flash?
                  kglad Adobe Community Professional & MVP
                  no, i think it opens in a browser window if it's a file type that a browser can parse. otherwise, it's presented for download.
                  • 6. Re: probably basic flash?
                    abeall Level 3
                    I think that any call to getURL() will open a browser if you aren't running the SWF in a browser -- in the case of projector .exe or stand alone .swf. But if playing in a browser, behavior is as you describe: getURL use browser window only if it can parse, otherwise prompts download. I imagine it is because getURL can only act in the context of a browser. So if a browser is not active with the SWF already it has to be activated.

                    All that said, I wonder what kenshamrock is actually trying to download, anyway :-)