Save a variables value into a existing .txt file with actionscript 3

浪尽此生 提交于 2019-12-11 18:35:06

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/28567787/save-a-variables-value-into-a-existing-txt-file-with-actionscript-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!