Xml/actionscript help -- please!

i am pulling my hair out with this and hope someone can help. i found scotty’s resizeable xml gallery on this site and tweaked it a little bit… now i’m stuck.

i tried to combine the xml slideshow navigation buttons into it and i can’t figure out how to have the buttons sync with the thumbnail buttons. the thumbnail clips are positioned in a small row at the bottom of the movie, as you click them the larger pic is loaded and resized into the container mc. when each thumbnail is selected alpha goes to 60. i added two buttons on the side - previous_btn and next_btn and added the following code:


function nextImage() {
	if (i<curLength-1) {
		i++;
		container.loadPic(pArray*, iArray*);
		disButtons2(i);
		info.text = id;
		trace((iArray*));
	} else {
		trace("end");
		return 0;
	}
}

function prevImage() {
	if (i>0) {
		i--;
		container.loadPic(pArray*, iArray*);
		disButtons2(i);
		trace((iArray*))
	} else {
		trace("start");
		return 0;
	}
}

// Next button
next_btn.onRelease = function() {
	nextImage();
}
// Previous button
previous_btn.onRelease = function() {
	prevImage();
}

this works okay, to navigate through the images one by one, but if you select a thumbnail button it throws off the order.

example: push next_button - goes to image 2 push thumbnail button 10 -goes to image 10, then if you push next again, it will go to image 3. what i want is to go to image 11 or previous goes to image 09.

i hope someone can help me… i can post the .fla, but the images are to big to include. after i get this figure out, i would like to add some sort of scroll, like the adding thumbnails tutorial, but also work with the next/previous btns, as well as the thumbnail btns.

any help is greatly appreciated!