I am playing around with saving .xml files from data in my game. I know how to convert an xml object to a ByteArray and write that to a FileReference. What I need to know now is how to go from an empty xml object (using var xml:XML = new XML()) to a fully populated xml object.
Can someone show me what functions to use to add nodes and values? Specifically I need to know how to make several of the same type of node. Here's a sample of what the final xml should look like:
<data>
<player>
<money>15831</money>
<shipType>1</shipType>
<ship>
<fuelCur>450</fuelCur>
<energyCur>160</energyCur>
<shieldCur>100</shieldCur>
<armorCur>40</armorCur>
<structCur>15</structCur>
</ship>
</player>
<currentSystem>3</currentSystem>
<currentPlanet>3</currentPlanet>
<date>
<year>2012</year>
<month>10</month>
<day>15</day>
</date>
<missionFlag>true</missionFlag>
<planet id="0">
<population>0</population>
</planet>
<planet id="1">
<population>29827632</population>
</planet>
<planet id="2">
<population>0</population>
</planet>
</data>
It might be useful to know how to remove and how to alter nodes and values, too.
Also, do I need to import something from the flash library to do this with XML? I'm using FlashDevelop, but when I type xml., FlashDevelop doesn't bring up suggestions like it normally does.