1 Reply Latest reply on Aug 7, 2009 7:27 AM by kglad

    Issue with setInterval

    Sreelash Level 1

      Hi,

           I implemented an image gallery with transition. The transition given in a movieclip and I calle \d to play each time when an image on teh thimbnail is clicked. Everything working well, when i run it in cs3 IDE. When i try to run the swf published on the folder, the transition is not working. I am using a setInterval in the method of transition. I think the issue is with setInterval. The portion of code for transition and image loading is given below.

       

      function transition() {
         
          openImg._alpha = 0;
          this._parent.Selected._alpha = 100;
      //    clearInterval(intervalID);
          for(i=0;i<tempArray.length;i++){
              tempArray[i].enabled = false;
          }
          openImg = this._parent.Selected;
          var indx = this._parent.name;
          link = imgThumbs[indx].img;
          obj = Holder2;   
          loadImageMain(link, obj);
          Holder1.setMask(trans);
          trans.gotoAndPlay(1);
          obj = Holder1;
          //clearInterval(intervalID);
          intervalID = setInterval(_load, 1700);   
      };
      function _load(){
          timerTxt.text = getTimer();
          loadImageMain(link, obj);
          clearInterval(intervalID);
          //thumbs_hldr.enabled = true;
      }

      function loadImageMain(link, obj) {
          var my_mcl_i:MovieClipLoader = new MovieClipLoader();
          var mclListnri:Object = new Object();
          mclListnri.onLoadInit = function(target_mc:MovieClip):Void  {               
          };
          my_mcl_i.addListener(mclListnri);
          my_mcl_i.loadClip(link,obj);
      }

       

      I want to give this gallery today itself. So anybody , please help me.

      Thank in advance

       

      Regards,

               Sreelash

        • 1. Re: Issue with setInterval
          kglad Adobe Community Professional & MVP

          it looks like you have a timeline transition and the setinterval is only used allow time for the transition to complete before loading the next image.  you should remove that setInterval() and call _load() when your transition completes.

           

          you also should not be creating mcl's and listeners:

           


          function loadImageMain(link, obj) {
             my_mcl_i.addListener(mclListnri);
             my_mcl_i.loadClip(link,obj);
          }
          var my_mcl_i:MovieClipLoader = new MovieClipLoader();
          var mclListnri:Object = new Object();
          mclListnri.onLoadInit = function(target_mc:MovieClip):Void  {
          };

          1 person found this helpful