Home > Flash > XML in Production (lazy)

XML in Production (lazy)

March 30th, 2009

I’m working a lot with international sites and there can often be times where the deadlines are short, customers aren’t so fast as I wish they where with feedback e.g.

This often messes up translations with XML files. They needs to be resend for changes and as the sites takes interaction you can find that things are missing.

Here is a small tip if you are running out of time, make sure your XML structure is simple, as well make sure that you are using unique id attributes. Then you can just combine the XML files and you don’t really need to go thru hours of copy/paste work.

A small example.
XML 1
<xml>
<gui>
<item id=”replay”>REPLAY</item>
<item id=”start”>START THE GAME</item>
</gui>
</xml>

XML 2
<xml>
<gui>
<item id=”volumeOff”>TURN ON VOLUME</item>
<item id=”volumeOn”>TURN OFF VOLUME</item>
</gui>
</xml>

So what I do is just to add on and on and combine the XML;s.

var copy:XML = levelLoader.getXML("data/en.xml");
var copy1:XML = levelLoader.getXML("data/en01.xml");
var copy2:XML = levelLoader.getXML("data/en02.xml");
copy = copy.appendChild(copy1.*);
copy = copy.appendChild(copy2.*);
 
var volumeOff : String = copy.gui.(@id=="volumeOff");

Flash , , , ,