# Kirupa PhotoGallery using XML tutorial

**URL:** <https://forum.kirupa.com/t/kirupa-photogallery-using-xml-tutorial/234756>\
**Category:** flash\
**Created:** [August 5, 2007, 9:39pm UTC](https://forum.kirupa.com/t/kirupa-photogallery-using-xml-tutorial/234756 "2007-08-05T21:39:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![urbanhumor](https://avatars.discourse-cdn.com/v4/letter/u/919ad9/32.png) [@urbanhumor](https://forum.kirupa.com/u/urbanhumor)\
**Post date:** [August 5, 2007, 9:39pm UTC](https://forum.kirupa.com/t/kirupa-photogallery-using-xml-tutorial/234756/1 "2007-08-05T21:39:37Z")

</div>

Hi,

I’m trying to customize a few things from the Kirupa Photogallery using XML tutorial.  
[http://www.kirupa.com/developer/mx2004/xml\_flash\_photogallery.htm](http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm)  
\*\*  
Two questions:\*\*

1. I wanna tweak this code so if you hit the next button on the last image, it loop back to this first image, and vice-versa, if you hit the previous button on the first image, it should go to the last image. I think its just tweaking these functions with a conditional statement but i can’t figure it out.

[COLOR=Navy]function nextImage() {

```
if (p&lt;(total-1)) {
    p++;

    if (loaded == filesize) {

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

}

```

}  
function prevImage() {

```
if (p&gt;0) {
    
    p--;
    picture._alpha = 0;
    picture.loadMovie(image[p],1);
    desc_txt.text = description[p];
    mat_txt.text = materials[p];
    picture_num();
}

```

}  
[/COLOR]  
2) I’m planning to have larger jpgs viewed in an external HTML page so i’m going to make separate HTML pages for each image. How do I write the actionscript for a getURL that updates the image number corresponding with the XML variable [p], which is keeping track of the image number in the gallery in the tutorial?

For example, I tried doing this: +[p] in the code to make the image number update in the url address but alas it didn’t work.

[COLOR=Navy]viewlarger.onRelease = function() {  
getURL(“[http://www.craighein.net/images/large/](http://www.craighein.net/images/large/)” + [p], “\_blank”);  
};[/COLOR]

Any help is much appreciated!
