Modifying Kirupa Image Gallery

I am modifying Kirupa.com’s XML/Flash Photo Gallery (http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm) so it includes a menu rather than just loading up the first image as soon as the movie is played. What I’ve done is add a new Scene, named “Scene 1” and renamed the original Scene to “Scene 2” (the one with the content).

In the first scene, I’ve placed a movieClip with instance name “menu_mc”. I’ve also moved the ActionScript from Scene 2 into Scene 1 (with the menu) and added some extra stuff to the ActionScript so that the “Description” names are grabbed out of the XML document and placed as separate items on the menu.

What I’d like is to have it so you may click a button and you’ll be taken to “Scene 2” and the corresponding image and text are displayed. Here’s the modified code I have in “Scene 1”:

stop();
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
///
var item_spacing = 28;
var item_count = 0;
///
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
///
var item_mc = menu_mc.attachMovie("menu_item", "item"+item_count, item_count);
item_mc._y = item_count*item_spacing;
item_count++;
myItem = item_mc.main_btn;
item_mc.menuitem_txt.text = description*;
myItem.onRelease = displayImage;//goes to function below in which I'd like to pass variables according to the button pressed
};
//}
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
function displayImage() {
//if (loaded == filesize) {
//somehow here I'll need to pass the variables onto "Scene 2" so that when
//the movie goes to "Scene 2", it knows what image and text to display that
//corresponds to the button just pressed at "Scene 1"
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
gotoAndPlay("Scene 2");
//}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}

The menu displays the description text perfectly, but I’m not too sure how I can pass the variables corresponding to the button clicked onto “Scene 2” for it to display that variable data. Can anyone help?

(I’ve posted the fla file up here if that helps: http://www.basemedia.com.au/hosted/help2/xml_photogallery_user.fla)
Cheers