保存变量值到一个现有的.txt文件使用ActionScript 3文件、变量值、txt、ActionScript

2023-09-09 21:29:22 作者:带着你爱她的心滚犊子

我想一个变量的值保存到一个现有的.txt文件。我已经以某种方式固定的,但而不是将其保存到一个现有的文件,它会创建一个新的.txt文件,每次...请帮我...

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...

这里是code:

var file:FileReference = new FileReference();

    var ba:ByteArray = new ByteArray();
    ba.writeUTFBytes(total);

    //save into drive
    file.save( ba, "register.txt" );

请帮帮我!

推荐答案

看的保存方法的文档:

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.

如果您使用的是AIR它看起来像你可以使用 FileStream.open ,以打开追加模式。

If you're using AIR it looks like you can use FileStream.open to open a file in APPEND mode.