Trouble creating Dynamic XML Active State Buttons

Hey everyone. I’m looking for an AS3/XML parsing pro to help me with an issue I’m having. The following xml file loads 7 icons (“url”) into an array. What I want to do is create an activestate using child (“activestate”) that replaces the “url” icon when clicked. I have no idea what the best way to do this would be. I’ve tried everything. The reason for this application is if i decide to change up the content down the line I won’t have to recode anything. Just update the icons.

xml

<?xml version=“1.0” encoding=“utf-8”?>
<images>
<image>
<url>pics/construct.jpg</url>
<activestate>pics/active/construct.jpg</activestate>
<big_url><![CDATA[swf/construct.swf]]></big_url>
</image>
<image>
<url>pics/energy.jpg</url>
<activestate>pics/active/energy.jpg</activestate>
<big_url><![CDATA[swf/energy.swf]]></big_url>
</image>
<image>
<url>pics/water.jpg</url>
<activestate>pics/active/water.jpg</activestate>
<big_url><![CDATA[swf/water.swf]]></big_url>
</image>
<image>
<url>pics/sustain.jpg</url>
<activestate>pics/active/sustain.jpg</activestate>
<big_url><![CDATA[swf/sustain.swf]]></big_url>
</image>
<image>
<url>pics/recycle.jpg</url>
<activestate>pics/active/recycle.jpg</activestate>
<big_url><![CDATA[swf/recycle.swf]]></big_url>
</image>
<image>
<url>pics/air.jpg</url>
<activestate>pics/active/air.jpg</activestate>
<big_url><![CDATA[swf/air.swf]]></big_url>
</image>
<image>
<url>pics/clean.jpg</url>
<activestate>pics/active/clean.jpg</activestate>
<big_url><![CDATA[swf/clean.swf]]></big_url>
</image>
</images>

AS3

import fl.containers.UILoader;
import caurina.transitions.*;

//---------loading the external xml file-------
var urlRequest:URLRequest = new URLRequest(“xml/pics.xml”);
var urlLoader:URLLoader = new URLLoader();
var myXML:XML = new XML();
var xmlList:XMLList;
myXML.ignoreWhitespace = true;
urlLoader.addEventListener(Event.COMPLETE,fileLoaded);
urlLoader.load(urlRequest);
//--------holds the paths to the thumbnails-------
var arrayURL:Array = new Array();
//--------holds the paths to the big photos-------
var arrayName:Array = new Array();
//--------holds the thumbnail objects-------
var holderArray:Array = new Array();
//--------represents the number of collumns-------
var nrColumns:uint = 7;
//-------represents the container of our gallery
var sprite:Sprite = new Sprite();
addChild(sprite);
var thumb:Thumbnail;
//-------- the thumbnails container-------
var thumbsHolder:Sprite = new Sprite();
thumbsHolder.graphics.beginFill(0xffffff,1);
thumbsHolder.graphics.drawRect(-80,-320,960,494);
thumbsHolder.graphics.endFill();
thumbsHolder.x = 100;
thumbsHolder.y = 425;
sprite.addChild(thumbsHolder);
//-------- the photoLoader container-------
var loaderHolder:Sprite = new Sprite();
loaderHolder.x = 1000;
loaderHolder.y = 10;
sprite.addChild(loaderHolder);
//-------- loads the swf-------
var photoLoader:UILoader = new UILoader();
photoLoader.width = 800;
photoLoader.height = 300;
photoLoader.buttonMode = true;
photoLoader.addEventListener(MouseEvent.CLICK,onClickBack);
loaderHolder.addChild(photoLoader);
/* we loop through the xml file
populate the arrayURL, arrayName and position the thumbnalis*/
function fileLoaded(event:Event):void {
myXML = XML(event.target.data);
xmlList = myXML.children();
for (var i:int=0; i<xmlList.length(); i++) {
var picURL:String = xmlList*.url;
var picName:String = xmlList*.big_url;
arrayURL.push(picURL);
arrayName.push(picName);
holderArray* = new Thumbnail(arrayURL*,i,arrayName*);
holderArray*.addEventListener(MouseEvent.CLICK,onClick);
holderArray*.name = arrayName*;
holderArray*.buttonMode = true;
if (i<nrColumns) {
holderArray*.y = 65;
holderArray*.x = i110+65;
} else {
holderArray
.y = holderArray[i-nrColumns].y+110;
holderArray*.x = holderArray[i-nrColumns].x;
}
thumbsHolder.addChild(holderArray*);
}
}
//----handles the Click event added to the thumbnails–
function onClick(event:MouseEvent):void {
photoLoader.source = event.currentTarget.name;
Tweener.addTween(loaderHolder, {x:10, time:1, transition:“easeInElastic”});
Tweener.addTween(loaderHolder, {alpha:1, time:1, transition:“linear”});
}
//----handles the Click event added to the photoLoader----
function onClickBack(event:MouseEvent):void {
Tweener.addTween(loaderHolder, {x:1000, time:1, transition:“easeInElastic”});
Tweener.addTween(loaderHolder, {alpha:0, time:2, transition:“linear”});
}

Thank you for your help in advance.