Advanced Slideshow Problem

I’m making a slideshow combined from 2 slideshows done on this forum (the one with the numbers as thumbnails and the one with the dynamic gallery buttons). Mostly got it to work but am having problems with 2 things:

  1. the quantity of thumbnail number buttons doesnt seem to refresh everytime I navigate to the next <pic>

  2. the <caption> text doesnt seem to load; it just uses the text from the first node. I did a test and it seems it’s like that for all the text (though i’m ok with the header and description behaving that way) but I need the caption to change for each picture.

Here is my example:
http://www.jacquettedesign.com/help/mastertemplate.html

and my code:
Please help, I’m banging my head against the wall!!:puzzled:


var current = 0;
var allLoaded = false;
function loadXML(loaded) {
    if (loaded) {
        //these 2 vars are for the number thumbs
        var item_spacing = 20;
        var item_count = 0;
        //the following code is for the gallery buttons
        for (var j = 0; j<this.firstChild.childNodes.length; j++) {
            if (!allLoaded) {
                var clip = navB.attachMovie("mc", "mc"+j, j);
                clip._x = 0;
                clip._y = 0+j*(clip._height+1);
                clip.my.text = this.firstChild.childNodes[j].attributes.name;
                clip.jvar = j;
                clip.onPress = presto;
                clip.onRollOver = roll;
                clip.onRollOut = away;

            }
        }
        allLoaded = true;
        xmlNode = this.firstChild.childNodes[current];
        image = [];
        before = [];
        caption = [];
        header = [];
        description = [];
        item_mc = [];
        total = xmlNode.childNodes.length;
        for (i=0; i<total; i++) {
            image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
            before* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
            caption* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
            header* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue;
            description* = xmlNode.childNodes*.childNodes[4].firstChild.nodeValue;
            item_mc* = numbersB.attachMovie("numberbtn", "item"+i, i);
            item_mc*.numberbtnid = i;
            item_mc*._x = i*item_spacing;
            item_mc*.myText.text = i+1;
            item_count++;
            item_mc*.onRelease = function() {
                picture.loadMovie(image[this.numberbtnid], 1);
                smallpic.loadMovie(before[this.numberbtnid], 2);
                desc_txt.text = description[0];
            };
        }
        firstImage();
    } else {
        content = "file not loaded!";
    }
}
function presto() {
    current = this.jvar;
    xmlData.load("contemporary.xml");
}
//this is the rollover and rollout for the navigation (there is a whitebox in the button that fakes the transparent look)
function roll() {
    current = this.jvar;
    this.whitebox._alpha = 50;
}
function away() {
    current = this.jvar;
    this.whitebox._alpha = 0;
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("contemporary.xml");
///////////////////////////////////// 
listen = new Object();
listen.onKeyDown = function() {
    if (Key.getCode() == Key.LEFT) {
        prevImage();
    } else if (Key.getCode() == Key.RIGHT) {
        nextImage();
    }
};
Key.addListener(listen);
previous_btn.onRelease = function() {
    prevImage();
};
next_btn.onRelease = function() {
    nextImage();
};
///////////////////////////////////// 
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;
        }
    }
    filesize = smallpic.getBytesTotal();
    loaded = smallpic.getBytesLoaded();
    smallpreloader._visible = true;
    if (loaded != filesize) {
        smallpreloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
        smallpreloader._visible = false;
        if (smallpic._alpha<100) {
            smallpic._alpha += 10;
        }
    }
};
function nextImage() {
    if (p<(total-1)) {
        p++;
        if (loaded == filesize) {
            picture._alpha = 0;
            picture.loadMovie(image[p], 1);
            smallpic._alpha = 0;
            smallpic.loadMovie(before[p], 2);
            caption_txt.text = caption[p];
            head_txt.text = header[0];
            contentMain.para_txt.text = description[0];
            picture_num();
        }
    }
}
function prevImage() {
    if (p>0) {
        p--;
        picture._alpha = 0;
        picture.loadMovie(image[p], 1);
        smallpic._alpha = 0;
        smallpic.loadMovie(before[p], 2);
        caption_txt.text = caption[p];
        head_txt.text = header[p];
        contentMain.para_txt.text = description[0];
        picture_num();
    }
}
function firstImage() {
    if (loaded == filesize) {
        picture._alpha = 0;
        picture.loadMovie(image[0], 1);
        smallpic._alpha = 0;
        smallpic.loadMovie(before[0], 2);
        caption_txt.text = caption[0];
        head_txt.text = header[0];
        contentMain.para_txt.text = description[0];
        picture_num();
    }
}
function picture_num() {
    current_pos = p+1;
    pos_txt.text = current_pos+" / "+total;
    getButtons();
}