Hi!
I have just started to learn more about XML in Flash but so far it’s all a bit confusing.
I have this photo site that I’m working on at the moment and I can’t figure out how to load dynamically specified photo galleries.
I load in my XML on the first frame of the root timeline with this script:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
_global.titel = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
_global.title* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
}
}
};
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("photos.xml");
This works perfectly when creating a dynamic menu. I just call the global Titel variable inside my menu_mc.
The problem is I have decided to go deeper into the hierarchy of my XML and add Thumbnail- and Picture-urls under every gallery title.
Here’s my XML:
<photos>
<item>
<title>Ought to be Freer</title>
<date>October 12th, 2003</date>
<venue>Kulturbolaget, Malmö</venue>
<galleries>
<gallery>
<thumbnails>
<thumbnail>/photos/ought_to_be_freer/t1.jpg</thumbnail>
<thumbnail>/photos/ought_to_be_freer/t2.jpg</thumbnail> </thumbnails>
<photos>
<photo>/photos/ought_to_be_freer/f1.jpg</photo>
<photo>/photos/ought_to_be_freer/f2.jpg</photo>
</photos>
</gallery>
</galleries>
<description>This set was taken during an intense concert bla, bla, bla...</description>
</item>
</photos>
Now, I don’t have any difficulties parsing out the description, date or venue but since I have to know how many galleries there is in every Item and then put their URLS in arrays I have som problem calling the Photos/Thumbnails.
I’ll be extremely thankful if anyone would like to help me with this.
Especially if someone could tell me later how I do a for loop inside an mc to extract the data.
Regards,
spaceman_helge