Improve company productivity with a Business Account.Sign Up


Rebuild XML data

Posted on 2004-10-10
Medium Priority
Last Modified: 2010-04-03

I am reading a XML file into Flash.

Creating Arrays from the Data.

Then, I am modifying these arrays.

And then, I want to recreate the XML again which will be sent to a server side script to update the origional XML on the server.

Can anyone suggest how to i do this? I dont know how to recreate the XML after the Arrays have been modified.
Any suggestion is welcome.

Question by:ssdesign
  • 3
  • 2
LVL 27

Accepted Solution

negatyve earned 900 total points
ID: 12270203
ok, follow me:

• create a new xml file, named "test.xml"
• write inside it:

<?xml version="1.0" encoding="UTF-8" ?>

• create a flash movie in the same folder
• test this code:

data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success)
            // edit xml file
      } else {
            // xml file missing
            trace("XML FILE NOT FOUND");
function editXML(xml)
      // show source xml file in the output windo
      // create an empty array
      var temp_array = new Array();
      // select the items node sequence in the xml file
      var nodes = xml.firstChild.childNodes;
      for(var i = 0; i < nodes.length; i++){
            // push inside the array the numeric value of each item
      // show in the output window the filled array
      // add a value to each element (modify)
      for(var i = 0; i < temp_array.length; i++){
            temp_array[i] = temp_array[i] * 2;
      // show in the output window the modified array
      // create the new xml
      var new_xml = new XML('<?xml version="1.0" encoding="UTF-8" ?><data></data>');
      // add nodes
      for(var i = 0; i < temp_array.length; i++){
            // create the node
            var new_node = new_xml.createElement("item");
            // append inside it the corresponding array element as text
            // insert it in the new xml
      // trace the new xml

Author Comment

ID: 12284401
ok thats looks quiet ok, i will need to try it.

I will get back soon with my feedback wether it worked or not.

Just need to try it with my application.
LVL 27

Expert Comment

ID: 12295537
That's ok, take your time.. :)
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.


Author Comment

ID: 12320910
I have not forgotten, give me just one more day. Ok?
LVL 27

Expert Comment

ID: 12346439
>I have not forgotten, give me just one more day. Ok?

hehe, that's right, no worries...

Expert Comment

ID: 12472116
i know this is closed and all but that was a great answer.  to the original poster: feel lucky :D  information like that can be (is) expensive and rare.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question