var data:String = "<item>" + d1 + "</item>" + "\r\n";//有几条数据就这样写几条 var results:String = "<data>" + data + "</data>"; var file:File = new File(path + "results.xml"); var fileStream:FileStream = new FileStream(); fileStream.open(file, FileMode.WRITE); fileStream.writeUTFBytes(results); fileStream.close();