XML Gallery looping problem

Hi all, I’m a Flash newbie and I’ve been trying to create an XML gallery based on the simple gallery tutorial here (Flash CS3). It’s meant to just load the pictures and move forward and backwards with a prev/next button. I’m trying to get it to loop once it reaches the last picture back to the first but can’t seem to do it. Here’s my code for the prev and next buttons:

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 firstImage() {

if (loaded == filesize) {

picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();

}

}

I’d also like for it to load the pictures in the center of the image_mc and not load with fade in/fade out transitions. Is that possible?

Hopefully someone can help, I’ve got tufts of bare skin on my head where skin used to be!

Thanks in advance!