10 Replies Latest reply on Apr 14, 2007 11:13 AM by The Feldkircher

    Creating a text file

    Wilme-trix
      How could I create a text file from Flash???

      All I've been able to do is to open an existing textfile and read the variables and its values. But what I really need to do is as follows:

      1. Create a text file. (from Flash - without ASP or PHP programming because the animation will be executed from a local folder, not in Web).
      2. Save the variables' names and values obtained from the Flash execution.

      Does anybody know how could I do that? confused;

      Please, let me know if that's not possible using only Flash.

      Thanks,

      WILMER
        • 1. Re: Creating a text file
          Greg Dove Level 4
          Its not possible using just flash.

          If its a projector style application instead of local html content then there are 3rd party tools that can bridge the gap and give you an api that lets you do a lot more with local files. Zinc is quite well known but there are others as well. And for as3 there's apollo, which is new.

          If its a swf in html, then you can save data, but you need to do it in a local sharedObject.
          • 2. Re: Creating a text file
            Wilme-trix Level 1
            Thanks. If anybody else has more information about or could give an URL to check an example, I'd would appreciate it. Thanks again, because it tells me I have to look for something additional to Flash.
            • 3. Re: Creating a text file
              kglad Adobe Community Professional & MVP
              why are you saving variable names/values? if it's only to later retrieve those things while the same or another swf is opened, you can use the sharedobject (as mentioned by gwd) and you'll need nothing in addition to flash.
              • 4. Re: Creating a text file
                Greg Dove Level 4
                kglad has a good point. Unless you need the name value pairs to be accessed by some other application (other than flash) and they must be in a text file to be accessible, then you can just use a flash sharedObject - i.e. just flash.

                And please don't think from my earlier comment that projector files can't use sharedObjects as well - they can.
                • 5. Re: Creating a text file
                  Wilme-trix Level 1
                  Hi everybody again.

                  Well, I'm really happy to see all your comments and sugestions.

                  Let me tell you about the project I'm working on. It is a kind of Software Simulation where on each slide of the simulation I capture the way the user behaves (clicking, typing, etc) and at the end of the process I got the summary of the activity, I can show him the result, but... now he wants to save that result in a text file at his own PC without a connection to the network.

                  All is done but the last part. Saving the result of the test at the selected folder in the user PC as a text file is what I need to do.

                  Thanks a lot, Wilme-trix (that's the reason I'm really worry about).
                  PD: I'm gonna read about the "sharedObjects" instructions you have told me. It's good to know I can find people like you.
                  • 6. Re: Creating a text file
                    Greg Dove Level 4
                    Sounds like you've done the hard part! sharedObjects are good to learn about, but won't help you if you want text files. Does the machine you're running the simulation on have an email client set up and the user's have all their own email accounts (you said they're not connected to the network, but I don't know if that means they could still have private email addresses etc)?

                    It might be possible just to use a mailto: type link with the email address, subject and body fields pre-populated with the results - sending it to the user. All that would then be required is to click send in the email client. Its a little bit flakey I know, but might be an option.
                    • 7. Re: Creating a text file
                      Greg Dove Level 4
                      Only other thing I can think of (again its a bit rough) is using System.setClipboard with the data and pasting into notepad. The email option is probably easier for users.
                      • 8. Re: Creating a text file
                        Greg Dove Level 4
                        Would it be acceptable to embed the flash in a ms office document? (after adjusting the macro security settings etc to prevent warnings)?
                        If you know VBA you could do it that way. Send the data with a FSCommand to vba, then use vba to save the text file.

                        http://vbcity.com/forums/topic.asp?tid=22129

                        Otherwise if you want a third party tool to do it, then search for
                        flash projector tools in google. These only either work with existing or create new executables... I think if you're running your simulation in an html page locally then you are limited to the approaches I mentioned above.

                        Here's what looks like a good list:
                        http://www.swftools.com/tools-category.php?cat=290

                        • 9. Re: Creating a text file
                          Wilme-trix Level 1
                          Hi. GWD.

                          This one sound such a great idea, why not? I will study the possibility and for sure I'll let you know how I found it.

                          Thank you. You're very kind.
                          • 10. Re: Creating a text file
                            The Feldkircher Level 2
                            Hi

                            Check out the External Interface API that was introduced with Flash 8

                            Hope it helps