I have intermediate Flash CS4 AS3 knowledge but little experience. Trying to make a photo gallery for our company website.

I have an XML doc with our photos listed. The menu for the pictures are numbers as MCs. Instead of coding each number to correspond to the XMLList I want to create an array that links that button to the corresponding picture in the XML based on its index number.

In plain English:
When you click on pic2 (instance name for 1_btn), which is listed at index [1] of the picNavArray, I want the picLoader source to be the picture in picsList[2] which is my XMLList variable.

var picNavArray = [pic1, pic2, pic3, pic4, pic5, pic6, pic7, pic8, pic9, pic10, pic11, pic12, pic13, pic14, pic15, pic16, pic17, pic18, pic19];
for each (var btn in picNavArray) {
	btn.addEventListener(MouseEvent.CLICK, onClick);
	btn.addEventListener(MouseEvent.ROLL_OVER, showThumb);
	btn.buttonMode = true;

function onClick (event:MouseEvent):void
	MovieClip(root).pl_mc.picLoader.alpha = 0;
//The line I need help with//
	MovieClip(root).pl_mc.picLoader.source = picsList[2].pAddress;
	MovieClip(root).pl_mc.picLoader.addEventListener (Event.COMPLETE, MovieClip(root).setPic);
	MovieClip(root).pl_mc.picLoader.addEventListener (ProgressEvent.PROGRESS, MovieClip(root).preLoad);
In my main timeline my picList is defined:

var picsList:XMLList;
Thank you for all your help.