• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

XML Data Issues

New Here ,
Jun 21, 2012 Jun 21, 2012

Copy link to clipboard

Copied

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

TOPICS
ActionScript

Views

463

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 21, 2012 Jun 21, 2012

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines