使用AS3保存XML文件

时间:2015-05-19 09:44:11

标签: xml actionscript-3 flash

有没有办法将其实际保存为XML文件本身,然后分别读入flash文件?

var book:XML = <book/>;
book.publisher = <publisher/>;
book.publisher.@name ="O'Reilly";

book.title = "Learning ActionScript 3.0";

book.appendChild(<subject/>);
book.subject.prependChild("Action Script");
book.insertChildAfter(book.subject, <authors/>);

book.authors.author.firstname = "Zevan";
book.authors.author.lastname = "Rosser";

var tempList:XMLList = book.authors.author.copy()
tempList[0].firstname = "Rich"
tempList[0].lastname = "Shupe"
book.authors.insertChildBefore(book.authors.author, tempList);

trace (book); 

2 个答案:

答案 0 :(得分:0)

有一种方法,事实上已经有关于堆栈溢出的问题,并且有足够的答案,你可以检查:Flash Actionscript 3 saving a XML file locally has a "Save As" window (How can I remove it?)。 无论如何,你可以使用AIR来做,因为flash有一个库可以帮助你将文件保存为后台进程,你可以在这里找到你需要的所有信息:http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.html

答案 1 :(得分:0)

您可以将其另存为xml。并在闪存中读取。将其存储在本地并使用共享对象。检查this link以供参考。

相关问题