Saving a change to attributes in a pre-existing XML file using AS3
So here's the situation: I have an XML file that is holding a short list of nodes, all of which have two attributes associated with name and a score. This file is already loaded into flash and creates a high-score table, of sorts.
Now, what I want to do is to be able to grab data collected in the application, use that to change some attributes in the XML file and have it save that change. As it is I can change the attributes using:
myXML.children()[t].@attr = attributeVariable;
Which seems to work while the application is still in session, but does not actually save those changes to the开发者_开发知识库 file itself as I am hoping for. Is there any quick and clean way of doing what I'm hoping to get done?
You don't specify if you are on a server/webpage or if this is an AIR application, so I will assume you're referring to a server/webpage.
Flash on its own cannot save a file to a server. You will need some kind of scripting language here such as PHP, C#, Ruby, or something else you have available to actually take the string value of your XML and write it to a file on the server.
Here are a website that has a tutorial on doing this in PHP - http://www.kirupa.com/forum/showthread.php?t=262784
精彩评论