# Problem with modifying the photo gallery tutorial

**URL:** <https://forum.kirupa.com/t/problem-with-modifying-the-photo-gallery-tutorial/67381>\
**Category:** flash\
**Created:** [October 15, 2004, 9:42am UTC](https://forum.kirupa.com/t/problem-with-modifying-the-photo-gallery-tutorial/67381 "2004-10-15T09:42:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adey](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@Adey](https://forum.kirupa.com/u/Adey)\
**Post date:** [October 15, 2004, 9:42am UTC](https://forum.kirupa.com/t/problem-with-modifying-the-photo-gallery-tutorial/67381/1 "2004-10-15T09:42:12Z")

</div>

After basing the gallery on the tutorial here:

[http://www.kirupa.com/developer/mx/photogallery.htm](http://www.kirupa.com/developer/mx/photogallery.htm)

I have put 37 photos in the array and added some navigation that enables the user to view a specific photo in the sequence, rather than just scrolling through the whole sequence one by one using next and prev buttons. This is the code I used on each button:

on (release) {  
\_root.changePhoto(“2”);  
}

The problem I am having is that this is calling the wrong photo. I suspect the problem is related to this part of the code from the tutorial:

```
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex&lt;0) {
	this.pIndex += this.pArray.length;
}

```

but I don’t really understand this bit of code. Any help would be greatly appreciated.

Ade.
