6 Replies Latest reply on Jul 11, 2006 9:38 AM by mxc

    How can you make flash create file or export text

    ShaneFred
      I need to produce a button that will create a file of any type when it is clicked. It can be an empty .txt file or any other type of file. I am using a flash intro to another program and when this exported .txt file is seen, the program will know to skip the intro. I have no idea how to do this. I am new to flash and I know some actionscript, but nothing that complicated. Thanks!
        • 1. Re: How can you make flash create file or export text
          Level 7
          ShaneFred,

          > I need to produce a button that will create a file of any
          > type when it is clicked.

          This cannot be done with Flash alone.

          Assuming this is not a web presentation -- that is, assuming this Flash
          content runs on the user's hard drive -- you could try one of the many 3rd
          party Projector warppers, such as Jugglor or ZINC. Those (and others) allow
          you to create files, access folders, etc.

          Flash simply wasn't designed to accommodate what you're after.


          David
          stiller (at) quip (dot) net
          Dev essays: http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: How can you make flash create file or export text
            mxc Level 1
            I think more specifics are needed before I say that Flash cannot do as you wish ;)
            There may be another way to achieve your goal.
            What other program is Flash the intro to? Why generate a file and why of "any type"?

            The most usual way to set a skip intro would be to set a flag if the user has been there before. Depending on the application the flag info would be stored in the appropriate way feks as a shared local object

            best regards
            Michael
            • 3. Re: How can you make flash create file or export text
              ShaneFred Level 1
              Thanks for your help... The program is a shipping program my company writes. I am adding a flash intro that runs when the user opens the program up. I already have a "skip intro" button, but I also want to add a button that will allow the user to "always skip intro" if they choose, so they don't have to click "skip intro" every time they open it. I was told by our programmers that if I can export some type of file when they click on the "always skip intro" button, then they will tell our program to look for that file. If our program sees that this file has been created then it will skip the intro. This is not for the web, it is just a stand alone program that runs on PC's. I am open to any alternative ideas instead of using a button or whatever might work better to achieve the same results needed.. Thanks!
              • 4. Re: How can you make flash create file or export text
                Level 7
                ShaneFred,

                > I also want to add a button that will allow the user
                > to "always skip intro" if they choose, so they don't
                > have to click "skip intro" every time they open it.

                Gotcha.

                > I was told by our programmers that if I can export
                > some type of file when they click on the "always
                > skip intro" button, then they will tell our program to
                > look for that file.

                Sure, that makes perfect sense. What you're after, then, is the
                SharedObject class, which writes the Flash equivalent of a browser cookie to
                the user's machine. This the only way to write persistent data in
                ActionScript without some sort of Projector wrapper or server-side code.


                David
                stiller (at) quip (dot) net
                Dev essays: http://www.quip.net/blog/
                "Luck is the residue of good design."


                • 5. Re: How can you make flash create file or export text
                  ShaneFred Level 1
                  Thanks for your help David! I am kind of new to actionscript. Is there any more info you can give me regarding the code? Can I put this code on the button, so when it is clicked it writes a cookie to the user's computer?

                  I looked up SharedObject in flash help, but I'm still unsure what code I need to use. Do I use the "on release"? If so, what is the actual script I should use for the SharedObject class to export this cookie? or where can I find it in flash help?

                  Thanks!
                  • 6. Re: How can you make flash create file or export text
                    mxc Level 1
                    I concur. Just make sure the end user is aware that they must allow Flash to write the shared object. Some companies have strict (not to say irrational) security policies.

                    You could also ask your programmers about the possibility of writing a C++ (or whatever language your shipping program uses) program shell which could allow the flash intro and the shipping program to communicate.
                    Best of luck with whatever solution you choose.

                    Michael