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 version=“1.0” encoding=“utf-8”?>


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;
//--------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();
var thumb:Thumbnail;
//-------- the thumbnails container-------
var thumbsHolder:Sprite = new Sprite();,1);,-320,960,494);;
thumbsHolder.x = 100;
thumbsHolder.y = 425;
//-------- the photoLoader container-------
var loaderHolder:Sprite = new Sprite();
loaderHolder.x = 1000;
loaderHolder.y = 10;
//-------- loads the swf-------
var photoLoader:UILoader = new UILoader();
photoLoader.width = 800;
photoLoader.height = 300;
photoLoader.buttonMode = true;
/* we loop through the xml file
populate the arrayURL, arrayName and position the thumbnalis*/
function fileLoaded(event:Event):void {
myXML = XML(;
xmlList = myXML.children();
for (var i:int=0; i<xmlList.length(); i++) {
var picURL:String = xmlList*.url;
var picName:String = xmlList*.big_url;
holderArray* = new Thumbnail(arrayURL*,i,arrayName*);
holderArray*.name = arrayName*;
holderArray*.buttonMode = true;
if (i<nrColumns) {
holderArray*.y = 65;
holderArray*.x = i110+65;
} else {
.y = holderArray[i-nrColumns].y+110;
holderArray*.x = holderArray[i-nrColumns].x;
//----handles the Click event added to the thumbnails–
function onClick(event:MouseEvent):void {
photoLoader.source =;
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.