# XML Gallery photo Loop w/out Slideshow

**URL:** <https://forum.kirupa.com/t/xml-gallery-photo-loop-w-out-slideshow/241821>\
**Category:** flash\
**Created:** [October 18, 2007, 2:13pm UTC](https://forum.kirupa.com/t/xml-gallery-photo-loop-w-out-slideshow/241821 "2007-10-18T14:13:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abydos641](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@Abydos641](https://forum.kirupa.com/u/Abydos641)\
**Post date:** [October 18, 2007, 2:13pm UTC](https://forum.kirupa.com/t/xml-gallery-photo-loop-w-out-slideshow/241821/1 "2007-10-18T14:13:51Z")

</div>

Hi everyone! First question, but I’ve loved this site since it taught me my first line of PHP. Anyhow, here’s my query concerning this tutorial:

[http://www.kirupa.com/developer/mx2004/xml\_slideshow3.htm](http://www.kirupa.com/developer/mx2004/xml_slideshow3.htm)

Is there a way to get the photos to loop by clicking on the next button without using the slideshow function?

I want the images to return to the first image when the next arrow is clicked and the last image is being displayed. I tried amending the code as such:

(The bolded section is what I added from the slideshow tutorial to the original photo gallery tutorial.)

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();  
**if (p == (total-1)) {  
p = 0;  
firstImage();  
} else {  
nextImage();  
}**  
}  
}  
}

But all I end up with is a broken photo gallery that won’t proceed beyond the first image. In effect, returning it to the first image every time the next button is clicked.

Any thoughts?
