0 Replies Latest reply on Oct 25, 2006 6:14 AM by

    Flash Image Gallery-Please Help!!!!

      I want to build a flash image gallery, which is similar to ( http://www.whispersphotography.com/) I have already designed 20% of it. But there are few mistakes. So I want your help to sort-out this problems. First I want to resize main move clip and change images automatically (without click button) in the gallery.
      (this is what I did)- http://www.grapx.com/production/creationstream/ver01/
      this is the main action script

      fscommand("allowscale", "false");
      Stage.scaleMode = "noScale";

      targetPhoto._visible = false;

      slides_xml = new XML();
      slides_xml.onLoad = loadSlideShow;
      slides_xml.load("album.xml");
      slides_xml.ignoreWhite = true;

      function loadSlideShow(success) {
      if (success == true) {
      rootNode = slides_xml.firstChild;
      totalSlides = rootNode.childNodes.length;
      currentSlideNode = rootNode.firstChild;
      photos = new Array(totalSlides);
      thumbs = new Array(totalSlides);
      captions = new Array(totalSlides);
      tx = 0;
      for (i=0; i < totalSlides; i++) { // populate arrays and create thumbnails dynamically
      photos = currentSlideNode.attributes.jpegURL;
      thumbs
      = [currentSlideNode.attributes.jpegWidth,currentSlideNode.attributes.jpegHeight];
      captions = currentSlideNode.firstChild.nodeValue;
      _root.attachMovie("thumb","thumb"+i,i);
      _root["thumb"+i]._x = tx;
      _root["thumb"+i]._y = 595; // using fixed Y coord
      _root["thumb"+i].tindex = i;
      tx += 22;
      currentSlideNode = currentSlideNode.nextSibling;
      }
      // initialize values
      currentIndex = 0;
      targetWidth=thumbs[currentIndex][0]; // get width
      targetHeight=thumbs[currentIndex][1]; // get height;
      updateSlide();
      }
      }

      function updateSlide() { // load photo, update caption and status fields
      targetPhoto.loadPhoto(photos[currentIndex]);
      caption = captions[currentIndex];
      statusField = (currentIndex+1) + "/" + totalSlides;
      }

      function slideShow() {
      if (currentIndex == totalSlides-1) { currentIndex = 0; } else { currentIndex++; }
      targetPhoto._visible = false;
      targetWidth=thumbs[currentIndex][0]; // get width
      targetHeight=thumbs[currentIndex][1]; // get height;
      updateSlide();
      }

      MovieClip.prototype.loadPhoto = function(fn) { // load external jpeg method + preloader
      this.createEmptyMovieClip("holder", 1);
      this.holder.loadMovie(fn);
      this.onEnterFrame = function() { // NOTE: could use this to display percentage to user
      if (Math.floor((this.holder.getBytesLoaded()/this.holder.getBytesTotal())*100) >= 100) {
      delete this.onEnterFrame;
      }
      }
      }


      ------------------------------------------------------------------------------------------ -----------------------------------------------------------
      Button code


      on (press) {
      _root.targetPhoto._visible = false;
      _root.targetwidth=_root.thumbs[tindex][0]; // get width
      _root.targetheight=_root.thumbs[tindex][1]; // get height;
      _root.currentIndex=tindex;
      _root.updateSlide();
      }