0 Replies Latest reply on May 7, 2007 5:44 AM by ced--ced

    Gallery problem with next/prev buttons

    ced--ced
      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! :)
      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:

      var previous = "none";
      if (_global.currentImage == 1) {
      previous = _global.photoNum;
      } else {
      previous = _global.currentImage-1;
      }


      _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 ( _global.currentImage = previous;) and loading it ( mcLoader.loadClip("images/photo"+previous+".jpg", _level0.images_mc.holder_mc);).

      The next button is based on the same code:

      var next = "none";
      if (_global.currentImage == _global.photoNum) {
      next = 1;
      } else {
      next = _global.currentImage+1;
      }


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

      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!