My current code for making the XML, adding the data and saving it is:
import flash.events.MouseEvent;
import flash.net.FileReference;
import flash.events.Event;
stop();
btn_exit.addEventListener(MouseEvent.CLICK, exitConfirm); //IGNORE THIS
btn_submit.addEventListener(MouseEvent.CLICK, submitData); //Submit data event
//IGNORE THIS
function exitConfirm(e:MouseEvent):void {
gotoAndPlay(5);
}
//On "CLICK", Submit data event
function submitData(e:MouseEvent):void {
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loadXML);
loader.load(new URLRequest("events.xml"));
function loadXML(e:Event):void {
xml = new XML(e.target.data);
trace(xml);
}
var file:FileReference = new FileReference;
var app:XML = <app/>;
app.titles = comp_title.text;
app.titles.category = comp_category.text;
app.titles.place = comp_place.text;
app.titles.dateDay = null;
app.titles.dateMonth = null;
app.titles.dateYear = null;
app.titles.gear = null;
file.save(app, "events.xml");
}
My problem is that it only creates this code in the XML file. I have tried adding more code onto this to first find the data on the existing XML then get that and add on the new data, but it doesn't seem to work. I'm not even sure if its possible, so that is why I have come here. Any help is good help!
P.S. AS3 is still fairly new to me. Im not horrible at it, but I aint good either :)
Cheers! :D