2 Replies Latest reply on Dec 11, 2006 5:20 AM by jonnybennett

    slideshow MC:

    jonnybennett Level 1
      I am trying to create a dynamic slideshow. The following code is within a m.c. called 'slideShowMc'.
      When you attach this movie clip it's code loops through a list of images fading one into the other. This is on a continuess loop. The code works fine the FIRST time you attach the m.c. Hoever when you remove it and reattach it, the code breaks down. However I don't understand why. There are no global variables within the code, so if it works first time it should work every time. Anyway this is the code... if you can see anything in the code that might stopit from working after the first attachment your help would be much appreciated. Thanks J....

      listOfImages=_parent.createSlideShow.testerText.text;

      //checking that the error is that the listofimages is being broken when reattached. Not a problem!!!
      tester.text=listOfImages;

      imagesArray=listOfImages.split("|");

      numberOfImages=imagesArray.length;

      thisTimeline=this;
      nInd=0;
      nIndexSlide=0;

      createMovieClip();

      function createMovieClip(){
      clearInterval(zoomInterval);
      if (nInd<numberOfImages){
      this.createEmptyMovieClip("my_mc"+nInd, nIndexSlide++);
      loadImage();
      }else
      {nInd=0;
      this.createEmptyMovieClip("my_mc"+nInd, nIndexSlide++);
      loadImage();}}


      function loadImage(){
      var myLoader = new MovieClipLoader();
      var myListener = new Object();
      myListener.onLoadInit = function(target:MovieClip){
      newWidth=350;
      newHeight=330;
      target._alpha=0;
      fadeInterval=setInterval(fadeEffect,10);
      }
      myLoader.addListener(myListener);
      myLoader.loadClip(imagesArray[nInd],"my_mc"+nInd);
      tester2.text=imagesArray[nInd];
      tester3.text=numberOfImages;
      tester4.text=hold;
      }


      function fadeEffect(){
      thisTimeline["my_mc"+nInd].setMask(masker);
      thisTimeline["my_mc"+(nInd-1)].setMask(masker2);
      thisTimeline["my_mc"+(numberOfImages-1)].setMask(masker3);
      thisTimeline["my_mc"+nInd]._alpha++;
      if (thisTimeline["my_mc"+nInd]._alpha>'100')
      {hold=100;
      tester4.text=hold;
      pauseInterval=setInterval(pauseImage,10);
      clearInterval(fadeInterval);}}


      function pauseImage(){
      if(hold!=0){
      hold--;}
      if(hold==0){
      tester4.text=hold;
      clearInterval(pauseInterval);
      if (nInd==0)
      {removeMovieClip("my_mc"+(numberOfImages-1));
      }
      removeMovieClip("my_mc"+(nInd-1));
      nInd++;
      createMovieClip();}}