XML gallery problem with back button

HI,
I have adapted the XML gallery here on Kirupas (photogallery) which has been working very well.
Now I am doing another one and I am having trouble with the back button.
When clicking it the first time keeps going forward insteda of changing to go back. After that it works backwards as intended but I can’t go all the way back to the first picture because the numbering § is wrong due to the first error. I don’t manage to see where I am going wrong.
Here are the codes. I have kept the traces.
First the XML-code:[AS]function loadXML1(loaded) {
if (loaded) {
xmlNode1 = this.firstChild.firstChild;
thumbnumber1 = [];
image1 = [];
description1 = [];
total1 = xmlNode1.childNodes.length;
for (i=0; i<total1; i++) {
thumbnumber1* = xmlNode1.childNodes*.childNodes[0].firstChild.nodeValue;
image1* = xmlNode1.childNodes*.childNodes[1].firstChild.nodeValue;
description1* = xmlNode1.childNodes*.childNodes[2].firstChild.nodeValue;
}
loadFirst1(image1[0], description1[0]);
} else {
bild_txt.htmlText = “file not loaded!”;
}
}
xmlData1 = new XML();
xmlData1.ignoreWhite = true;
xmlData1.onLoad = loadXML1;
xmlData1.load(“gallery1Data.xml”);
// ///////////////////////////////////
// ///////////////////////////////////
p = 0;
function loadFirst1(pic, desc) {
p++;
maskOut(pic, desc);
picture_num1();
}
function loadNext1(pic, desc) {
trace("before p++ "+p);
if (p<(total1)) {
p++;
trace(“second trace “+p);
maskOut(pic, desc);
picture_num1();
}
}
function loadPrevious1(pic, desc) {
if (p>0) {
trace(p+” before p–”);
p–;
trace("third trace "+p);
maskOut(pic, desc);
trace("fourth trace “+p);
picture_num1();
}
}
function picture_num1() {
current_pos = p+1;
pos_txt.text = current_pos+” / "+total;
}[/AS]and the functions:[AS]function maskOut(pic, desc) {
imageMC.imageMask.onEnterFrame = function() {
this.newy = -514;
if (this._y<=-513) {
picLoader(pic);
imageMC.desc_txt.text = desc;
delete this.onEnterFrame;
}
};
}
function picLoader(pic) {
imageMC.picContainer.loadMovie(pic);
var clip = this.createEmptyMovieClip(“theLoader”, this.getNewDepth());
clip.onEnterFrame = function() {
var t = _root.imageMC.picContainer.getBytesTotal();
var l = _root.imageMC.picContainer.getBytesLoaded();
if (t == l && _root.imageMC.picContainer._height>0 && _root.imageMC.picContainer._width>0) {
_root.imageMC.picContainer._x = Stage.width-_root.imageMC.picContainer._width;
_root.imageMC.picContainer._y = (Stage.height/2)-_root.imageMC.picContainer._height/2;
maskIn();
delete this.onEnterFrame;
}
};
}
function maskIn() {
imageMC.imageMask.newy = 0;
}[/AS]and here is the button-code:[AS]nextMC.onRelease = function() {
switch (true) {
case _currentframe == 2 :
loadNext1(image1[p], description1[p]);
break;
case _currentframe == 3 :
loadNext2(image2[p], description1[p]);
break;
case _currentframe == 4 :
loadNext3(image3[p], description1[p]);
break;
case _currentframe == 5 :
loadNext4(image4[p], description1[p]);
break;
case _currentframe == 6 :
loadNext5(image5[p], description1[p]);
break;
case _currentframe == 7 :
loadNext6(image6[p], description1[p]);
break;
case _currentframe == 8 :
loadNext7(image7[p], description1[p]);
break;
}
};
backMC.onRelease = function() {
switch (true) {
case _currentframe == 2 :
loadPrevious1(image1[p], description1[p]);
break;
case _currentframe == 3 :
loadPrevious2(image2[p], description2[p]);
break;
case _currentframe == 4 :
loadPrevious3(image3[p], description3[p]);
break;
case _currentframe == 5 :
loadPrevious4(image4[p], description4[p]);
break;
case _currentframe == 6 :
loadPrevious5(image5[p], description5[p]);
break;
case _currentframe == 7 :
loadPrevious6(image6[p], description6[p]);
break;
case _currentframe == 8 :
loadPrevious7(image7[p], description7[p]);
break;
}
};[/AS]Also attaching the XML-document.
If you want me to send pictures, I’ll take the time to do that.