I have to load a lot of information for 25 movies which load into a main SWF. And all the contents are loaded from a XML file.
This comes from a client’s file already programmed in AS2 so I cannot use AS3 to load the XML which is a lot easier.
This is an example of my xml structure:
<root>
<button>
<btn1>button 1</btn1>
<btn2>button 2</btn2>
</button>
<movies>
<movie id="slide1">
<title>Slide n1</title>
<text>Conteúdo 1</text>
</movie>
< movie id="slide2">
<title>Slide n2</title>
<text>Conteúdo 2</text>
<image id="one">bicycle.jpg</image>
</movie >
< movies>
</root>
There are about 25 slide nodes each with an ID. And each with a title, more than one text to load and some also have images.
Is there a way that I call each slide by its ID, instead of having to write the entire code for the nodes?
Right now I am using this AS2
my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(sucess) {
if (sucess) {
trace(my_xml);
}
};
// Load up the XML file into Flash
my_xml.load(‘modulo1.xml’);
// Load info for the buttons
btn1 = my_xml.firstChild.firstChild.childNodes[0].firstChild;
btn2 = my_xml.firstChild.firstChild.childNodes[1].firstChild;
// Slide One
****lide1 = my_xml.firstChild.firstChild.nextSibling.childNodes[0].firstChild.childNodes;
txtslide1 =my_xml.firstChild.firstChild.nextSibling.childNodes[0].firstChild.nextSibling.childNodes;
Coding it this way I will probably get lost along the way.
If I could get the slides by ID it would be a lot easier and faster to code.