I'm new to incorporating xml into my flash. I've used components that do all the linking for me, but have never tried doing the code myself. My project is a simple slide show, that has transitions on the timeline that are very important to the project. I have created an image holder movie clip symbol which is the same size as my images. I have created the slideshow using multiple instances (each with its own instance name slide01, slide02, etc) of this holder. All I want to do is load the .jpg files in from an xml file to populate the holder files before run time. I have gotten the code to work for the first image, but none of the others will populate. I am attempting to load the xml data into an array, then pull from the array to populate the mc symbols. I modified the code I found in a tutorial. Please help!
My AS2:
Code:
var x:XML = new XML();
x.ignoreWhite = true;
var urls:Array = new Array();
x.onLoad = function(success) {
var photos:Array = this.firstChild.childNodes;
for(i=0;i<photos.length;i++) {
urls.push(photos[i].attributes.url);
}
slide01.loadMovie(urls[0]);
slide02.loadMovie(urls[1]);
slide03.loadMovie(urls[2]);
slide04.loadMovie(urls[3]);
slide05.loadMovie(urls[4]);
slide06.loadMovie(urls[5]);
slide07.loadMovie(urls[6]);
slide08.loadMovie(urls[7]);
slide09.loadMovie(urls[8]);
slide10.loadMovie(urls[9]);
}
x.load("slideshow1.xml");
My XML:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<slideshow>
<photo url="01.jpg" />
<photo url="02.jpg" />
<photo url="03.jpg" />
<photo url="04.jpg" />
<photo url="05.jpg" />
<photo url="06.jpg" />
<photo url="07.jpg" />
<photo url="08.jpg" />
<photo url="09.jpg" />
<photo url="10.jpg" />
</slideshow>