Skip navigation
holdentorana74
Currently Being Moderated

XML Data Issues

Jun 21, 2012 5:24 PM

Tags: #flash #xml #actionscript #ac3 #actionscript3 #actionscript_3.0

Hi everyone,

I have run into a few issues involving adding data onto an already existing XML data file.

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 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 great either

Cheers!

- Mozza74

 
Replies
  • kglad
    72,228 posts
    Jul 21, 2002
    Currently Being Moderated
    Jun 21, 2012 9:16 PM   in reply to holdentorana74

    read the xml file, store the xml object in an XML variable, edit that variable and finally save it back to the original xml file.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points