7 Replies Latest reply on Feb 23, 2011 1:21 PM by Ned Murphy

    Infinite Loop Dynamic Image Scroller

    kad_911

                Hello,

      I'm making an Image Scroller which takes images dynamically from a folder and placing on stage.

      I've managed to get the images and to load inside a movieclip.

       

      Now when the mouse is moved to the left, the images are scrolled left. And when mouse is moved to the right, the images scroll to the right.

       

      But the problem is, I want the loop to restart when reaching the last image. My logic is, I'm duplicating the entire set of images right after the last image ends.

      So when scrolling, when the first image of the duplicate set comes to the start point, I want the movie to reset. So the transition wont be visible.

       

      My problem is.. I dont know how to reset the movie when the image is in place. Please help me.

      Here's the entire code.

       

       

      CODE FOR MAIN

      limitCount = new LoadVars();
      limitCount.load("files.txt");
      limitCount.onLoad = function(success){
              if(success){
                  limit = int(limitCount.NumberOfFiles);


      for(i=0; i<limit; i++){
      img_scroll.attachMovie("imgbar", "img"+i, img_scroll.getNextHighestDepth());
      img_scroll["img"+i]._x = i * 800;
      img_scroll["img"+i]._y = 0;
      loadMovie(i+1 +".jpg", img_scroll["img"+i].empty);
      }

      for(i=0; i<limit; i++){
      img_scroll2.attachMovie("imgbar", "img"+i, img_scroll2.getNextHighestDepth());
      img_scroll2["img"+i]._x = 800 * (limit+i);
      img_scroll2["img"+i]._y = 0;
      loadMovie(i+1 +".jpg", img_scroll2["img"+i].empty);
      }

      for(i=0; i<limit; i++){
      img_scroll3.attachMovie("imgbar", "img"+i, img_scroll3.getNextHighestDepth());
      img_scroll3["img"+i]._x = -800 * (limit-i);
      img_scroll3["img"+i]._y = 0;
      loadMovie(i+1 +".jpg", img_scroll3["img"+i].empty);
      }


             }

             
      }
          
       

       

       

      CODE FOR IMG_SCROLL1, IMG_SCROLL2 and IMG_SCROLL3

      onClipEvent (enterFrame) {
          if(_root._xmouse > 400){
             this._x -= 50;
          }
          if(_root._xmouse < 400){
                  this._x += 50;
          }

       

       

       

      IMG_SCROLL are the containers for the images.

      By the way, I'm getting the number of files in the folder using the files.txt file.

       

       

      Any help please??