Q:

Saving a text file from flash

Quick question - i am wishing to produce an offline high score system for a pinball game i am creating, that stores the 10 highest scores in a text document. I have no idea how to do this - so any help is greatly appreciated - I am using AS3 with flash, and if it's possible please make the answer as basic to understand as i am still doing very basic programming in Flash at this given moment, 
I currently have not tried anything yet as i have no idea where to start... 
thanks,
Sam.

A:

In order to write to a text file (have write access to your file system) you would need to publish your project as AIR application. I recommend you to use the SharedObject class for storing your data instead. You can for instance read and write an array with the scores easily, so no parsing is required.
        var scores : Array        = new Array(10,20,30);
        var my_so  : SharedObject = SharedObject.getLocal("myGameHighscore");
        my_so.data.scores         = scores; // set scores var to data object of SharedObject
        my_so.flush();            // writes the data instantly

        // To retreive your scores simply use getLocal again and then do something like:
        trace(my_so.data.scores[0]); // will trace first element of scores array "10"

Refer to http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SharedObject.html

