Gallery problem with next/prev buttons

Hi,

I’m working on a photo gallery and I have some weird things happening, hence the request for help!

When the gallery opens, you can click on any picture, the main one then appears with various buttons:

  1. Click on the image and you go back to the thumbnails - fine
  2. Click on the cross button and it’s the same - fine
  3. Don’t click on the automatic gallery, it’s no on yet! :slight_smile:
  4. Click on previous and the previous image appears - fine
  5. Click on next and the next image appears - nope, that’s where the problem is!

For the previous button, I use this code:

[COLOR=DimGray]var previous = “none”;
if (_global.currentImage == 1) {
previous = _global.photoNum;
} else {
previous = _global.currentImage-1;
}[/COLOR]

_global.currentImage is the number related to the thumbnail you have clicked.
_global.photoNum is the total number of pictures

After this code, there’s all the code for the preloader and it ends by defining the new current image ([COLOR=DimGray]_global.currentImage = previous;[/COLOR]) and loading it ([COLOR=DimGray]mcLoader.loadClip(“images/photo”+previous+".jpg", _level0.images_mc.holder_mc);[/COLOR]).

The next button is based on the same code:

[COLOR=DimGray]var next = “none”;
if (_global.currentImage == _global.photoNum) {
next = 1;
} else {
next = _global.currentImage+1;
}[/COLOR]

With at the end [COLOR=DimGray]_global.currentImage = next;[/COLOR] and [COLOR=DimGray]mcLoader.loadClip(“images/photo”+next+".jpg", _level0.images_mc.holder_mc);[/COLOR].

Here is the problem, there are three situation you use the next button:

  1. On the thumbnails, you click any image. When the main image is loaded, you click first previous, have the new image loaded and then you click next. The next image is loaded and it works fine.

  2. On the thumbnails, you click the last image. When the main image is loaded, you click next. The next image (which is then the 1st) is loaded and it works fine.

  3. On the thumbnails, you click any image. When the main image is loaded, you click next. Here is the problem: the next image is not loaded!

You can see it here: www.theminnesotafats.com/gallery
When you see that the picture is not loaded, you will have to refresh the page to make it work again.

I hope that those explainations are not too long and that somebody could help me. Thanks!