asdg>> technotes>> save to a file on pc with fscommand

Version: Flash 5, Flash MX
Date Added: May 31, 2001
Last Updated: December 31, 2002

As of Flash MX, typed data can be saved locally with a SharedObject instance, as documented in the Language Reference of ASDG2. Do not use fscommand() to store data if you are publishing to Flash Player 6 or later.

In Flash 5 it is possible to save variables to a text file using fscommand(). However, this technique:
~ is not documented nor supported by Macromedia
~ will quite probably be removed in the future
~ works only from Windows projectors (not in a browser)
~ saves only main timeline variables

Use at your own risk.

With that out of the way, here's how it works. To save the main timeline variables of a movie to a file in the same directory as your .swf file, use:
fscommand ("save","someFileName.txt");

To save to a file using an absolute path, use:
fscommand ("save","C:\\folderName\\someFileName.txt");

For example:
fscommand ("save","C:\\Winnt\\Profiles\\Colinm\\Desktop\\myVariables.txt");

Here's a sample movie that shows the technique in action.