Saving a text file from flash

SamCale

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.

Jan

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Saving text file from code

From Dev

Saving list from python to text file in format

From Dev

Python : saving variables from a text file created

From Dev

Saving ArrayList to Text File

From Dev

Saving PairedRDD as a text file

From Dev

Saving ArrayList to Text File

From Dev

How to store text file on embedded systems flash memory and read from it

From Dev

Extracting data from a text file using grep and saving it in another directory

From Dev

Importing data from text file and saving the same in excel

From Dev

Saving data internally to a text file from keyboard input

From Dev

Saving text from TextView

From Dev

Saving a text from UIAlertView

From Dev

Saving text from TextView

From Dev

from DataGridView saving to text file issue when saving date values on vb.net

From Dev

sorting collection of values from a text file and saving sorted values back to text file with pyspark

From Dev

Saving and formatting text file with Matlab

From Dev

Saving a data structure to a text file

From Dev

Saving output of a function to a text file

From Dev

trouble with saving ndarray to text file

From Dev

Saving textbox text into XML file

From Dev

Saving a batch variable in a text file

From Dev

Refreshing and Saving as a text file in Excel

From Dev

Saving user feedback in a text file

From Dev

trouble with saving ndarray to text file

From Dev

Saving text file in it's entirety

From Dev

Saving a copy of text file by matlab

From Dev

Saving a spinner position to a text file

From Dev

Saving output of a program in text file

From Dev

How to display variable text from a text file in textview in android like in news flash?

Related Related

HotTag

Archive