Hello:
I need help with AS that writes to an XML database. Been trying to follow the Kirupa tutorials (notably the 40-page XML/Flash tutorial), but I’m stuck.
I start with an initial XML file like this:
<inventorylist>
</inventorylist>
I want to add children to the file like this:
<inventorylist>
<item attribute1=“value1” attribute2=“value2” />
<item attribute1=“value1” attribute2=“value2” />
</inventorylist>
so I write in this code, tied to a button* onRelease* function:
// write new entry to inventory database
var entry_xml = new XML();
entry_xml.ignoreWhite = true;
entry_xml.appendChild(entry_xml.createElement("item"));
entry_xml.firstChild.attributes.size = size;
entry_xml.firstChild.attributes.title = title;
entry_xml.firstChild.attributes.price = price;
// ....
// et cetera
// ....
trace (entry_xml);
entry_xml.send(*absolute filepath of PHP script*);
I can see the entire XML entry traced to the Output window, looks fine.
The PHP script executes, but the send command in Flash writes over the initial XML file and makes it blank. It’s got to be something simple I’m overlooking - not referencing my children properly?
Please look at the AS and suggest changes so this will work for first and all subsequent entries. Thank you.