【问题标题】:Write more than one file in fileStream在 fileStream 中写入多个文件
【发布时间】:2014-12-10 17:18:36
【问题描述】:

我目前正在为我的作业开发一个天气应用程序。我想知道是否有办法让我在 fileStream 中写入多个项目。或者我是否需要创建一个新的 fileStream 来访问其他信息。

这是我在我的城镇编写的代码。

var fileStream:FileStream  = new FileStream();

//write file
function writeFile(town:String):void{
fileStream.open(file,FileMode.WRITE);
fileStream.writeUTFBytes("<root>\n\t<town>" + town + "</town>\n</root>"); 

fileStream.close();
}

【问题讨论】:

  • 只使用 FileMode.APPEND
  • @BotMaster 非常感谢 :)

标签: xml actionscript-3 flash filestream


【解决方案1】:

而不是FileMode.WRITE,使用FileMode.APPEND

function writeFile(town:String):void{
    fileStream.open(file,FileMode.APPEND);
    fileStream.writeUTFBytes("<root>\n\t<town>" + town + "</town>\n</root>"); 
    fileStream.close();
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-24
    • 2013-11-02
    • 1970-01-01
    • 1970-01-01
    • 2012-01-03
    相关资源
    最近更新 更多