F8-AS2- where to insert prevFrame() image gallery?

Hi there. I have a question that probably has a very simple answer to the ones in the know, but I’ just a beginner so tricky for me. Sorry if question is ridiculous…

I have made a xml image photo gallery from the tutorial here, with a “previous” and “next” button and it’s working well.

Now, I want the movie to go to the next frame in the timeline when I click on the “next” button and the previous frame when clicking “previous”

I tried to insert prevFrame() and nextFrame() in the functions nextImage() and prevImage(), but this does not work.
Could some please tell me if I can use these prevFrame()… functions (if, so where do I place them?) or if I’m on the wrong track?? Thanks.

 
 
desc_txt.embedFonts = true;
desc_txt.antiAliasType = "advanced";
desc_txt.gridFitType = "pixel";
 
function loadXML(loaded) { 
if (loaded) { 
xmlNode = this.firstChild; 
image1 = []; 
image2 = [];
thumb1 = [];
caption = [];
description = []; 
total = xmlNode.childNodes.length; 
for (i=0; i<total; i++) { 
image1* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue; 
image2* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue; 
thumb1* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue; 
caption* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue; 
description* = xmlNode.childNodes*.childNodes[4].firstChild.nodeValue; 
 
} 
firstImage(); 
} else { 
content = "file not loaded!"; 
} 
} 
xmlData = new XML(); 
xmlData.ignoreWhite = true; 
xmlData.onLoad = loadXML; 
xmlData.load("images4.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; 
} 
} 
}; 
function nextImage() { 
if (p<(total-1)) { 
p++;
if (loaded == filesize) { 
picture._alpha = 0; 
picture.loadMovie(image1[p], 1); 
thumb.loadMovie(thumb1[p], 1); 
cap_txt.text = caption[p];
desc_txt.text = description[p]; 
picture_num();
nextFrame();
} 
} 
} 
function prevImage() { 
if (p>0) { 
p--; 
picture._alpha = 0; 
picture.loadMovie(image1[p], 1); 
thumb.loadMovie(thumb1[p], 1); 
cap_txt.text = caption[p];
desc_txt.text = description[p]; 
picture_num(); 
prevFrame();
} 
} 
function firstImage() { 
if (loaded == filesize) { 
picture._alpha = 0; 
picture.loadMovie(image1[0], 1);
thumb.loadMovie(thumb1[0], 1); 
cap_txt.text = caption[0];
desc_txt.text = description[0];
picture_num();
 
} 
} 
function picture_num() { 
current_pos = p+1; 
pos_txt.text = current_pos+" / "+total; 
} 
 
prevFrame();
prevFrame();