The third Stage…
The error that I mention in the previous post is displaying the amount of money is fixed by using code (Math.round(totalCoins*100)/100).
And what I need to do at this stage is writing code to store data and loading back the data.
I have used the FileStream to write data to a text file,
import flash.filesystem.File;
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
//Create a file.
var file:File = File.documentsDirectory.resolvePath(“J:/…/…/… Multimedia Systems/…/…/money_txt.txt”);
//Create file stream to write data to file
var stream:FileStream = new FileStream();
stream.open( file, FileMode.WRITE );
//write data to file
stream.writeUTFBytes( money_txt.text=”You have:”+(Math.round(totalCoins*100)/100)+”dollars” );
//Close the WRITE file stream
stream.close();
And use text loader to read the stored data from the text file.
The code are:
//the path should be a problem of this application but I know how to fix it yet….
var PATH:String = “J:/…/…/… Multimedia Systems/…/…/money_txt.txt”;
var urlRequest:URLRequest = new URLRequest(PATH);
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.TEXT; // default
urlLoader.addEventListener(Event.COMPLETE, urlLoader_complete);
urlLoader.load(urlRequest);
function urlLoader_complete(evt:Event):void {
money_txt.text = urlLoader.data;
}

At this Stage they are all work when using Ctrl+Enter to test the moive, but after I quit the program and re-open swf file, all functions are not working expect loading data from the text…I hope I can fix it up in the next few days.
Next Stage: apply graphics and further development
