Help with modifing the Photo Slideshow Tutorial code

I’m sure that learning more about the action script I wouldn’t need to ask this but at this point I DKS about it…

I have the basic slideshow working in my site, but I want to add a little extra to it. My pages are in php and when I pass a link to the page like ?pg=2 I want to load a different set of pics from the xml file.

Currently the xml file is formatted:

 
<images>
    <pic>
       <image>mypic.jpg</image>
       <caption>My Pic</caption>
    </pic>
</images>

I would like to pass a variable through like this:

 
<images>
    <pic pg="1">
       <image>mypic.jpg</image>
       <caption>My Pic</caption>
    </pic>
    <pic id="2">
       <image>mypic.jpg</image>
       <caption>My Pic</caption>
    </pic>
</images>

So based on what I’ve read so far I think need to modify this section of the code to look for a variable:

 
function loadXML(loaded) { 
if (loaded) { 
xmlNode = this.firstChild; 
image = []; 
description = []; 
total = xmlNode.childNodes.length; 
for (i=0; i<total; i++) { 
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue; 
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue; 
}

So here’s my questions:

  1. I’m not sure I put the variable in the right place?
  2. how to make this code look for it?
  3. how do I pass the variable info into my actionscript?

Yes I’m fumbling my way though! but I’ll learn!
TIA