Call images from xml file based on url

I am a newbie to actionscripting and sure could use some help on this:

I need to embed a flash banner on pages that call images from a xml file based on the url of the page, i.e. if a person is on the “research page” I would want the movie to parse the images from the research gallery in the xml and pass it to actionscript (I think)…

The xml gallery looks like this:

<gallery library=“PUBLICATIONS” timer=“5” order=“sequential” fadetime=“2” looping=“yes” xpos=“0” ypos=“0”>
<image path=“images/image1.jpg” />
<image path=“images/image2.jpg” />
<image path=“images/image3.jpg” />
</gallery>

<gallery library=“RESEARCH” timer=“5” order=“sequential” fadetime=“2” looping=“yes” xpos=“0” ypos=“0”>
<image path=“images/image4.jpg” />
<image path=“images/image5.jpg” />
<image path=“images/image6.jpg” />
</gallery>


I snagged this javascript to get the url from a javascript on the html page:

<script type=“text/javascript”>
var theURL = document.location.href;
document.write(’<h1>’ + theURL + ‘</h1>’);
</script>


Questoin is:

How do I get the variable passed to the actionscript to parse the url and therefore load the appropriate image within the movie. I appreciate any help!