# XML Gallery - multiple images in loop

**URL:** <https://forum.kirupa.com/t/xml-gallery-multiple-images-in-loop/247443>\
**Category:** flash\
**Created:** [December 23, 2007, 8:11pm UTC](https://forum.kirupa.com/t/xml-gallery-multiple-images-in-loop/247443 "2007-12-23T20:11:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![daboogieman](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@daboogieman](https://forum.kirupa.com/u/daboogieman)\
**Post date:** [December 23, 2007, 8:11pm UTC](https://forum.kirupa.com/t/xml-gallery-multiple-images-in-loop/247443/1 "2007-12-23T20:11:49Z")

</div>

I’ve been searching through the forums but haven’t found a solution yet.  
I’m trying to modify the gallery to show several images at once, as well as loop. I’ve created a second instance of “picture” (picture2).

Here’s the code I’m using. It works, however when picture2 gets the the last image, it breaks. Any sugestions?:-/

function nextImage() {  
if (p\<(total-1)) {  
p++;  
if (loaded == filesize) {  
picture.\_alpha = 0;  
picture.loadMovie(image[p], 1);  
picture2.\_alpha = 100;  
picture2.loadMovie(image[p+1], 1);  
desc\_txt.text = description[p];  
picture\_num();  
}  
}  
}  
function prevImage() {  
if (p\>0) {  
p–;  
picture.\_alpha = 0;  
picture.loadMovie(image[p], 1);  
picture2.loadMovie(image[p+1], 1);  
desc\_txt.text = description[p];  
picture\_num();  
}  
}
