i want to save the value of a variable into a existing .txt file. i have fixed it in some way, but instead of save it into a existing file, it creates a new .txt file everytime... please help me...
here is the code:
var file:FileReference = new FileReference();
var ba:ByteArray = new ByteArray();
ba.writeUTFBytes(total);
//save into drive
file.save( ba, "register.txt" );
Please help me!
Looking at the documentation for the save
method:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference.html
There doesn't appear to be a way to use an existing file, it can only write to a new file. In other languages you would open the file in "append" mode. Due to the way Flash runs, it doesn't seem like this is possible.
If you're using AIR it looks like you can use FileStream.open to open a file in APPEND mode.