2 Replies Latest reply on Apr 17, 2006 11:09 PM by x913

    setInterval

    x913
      Hi, i am having problems using setInterval()
      This is my code:

      on(release){
      speed = 8;
      _root.onEnterFrame=function(){

      num=5;
      flip1 = setInterval(flip,500);

      function flip(){
      if(num<13){
      _root["new"+num].newb1._xscale += (-100 - _root["new"+num].newb1._xscale)/speed ;
      _root["new"+num].neww1._xscale += (-100 - _root["new"+num].neww1._xscale)/speed ;
      if(_root["new"+num].neww1._alpha <=100){
      _root["new"+num].neww1._alpha += 10;
      }
      }
      num++;
      if(num>12){
      clearInterval(flip1);
      }
      }

      }
      }

      Now firstly as far as i know the setInterval command can replace "onEnterFrame" but without it my movieclips wont tween.
      Also towards the end of the tweens the last MovieClip goes faster than the rest of them depening on "speed" and "setInterval"
      if i put "speed" down to 5 and "setInterval" down to 200 it runs almost the way its ment to.
      and because of this i realise my code can probably be improved apon, but im afraid i dont know enough to impove it yet.

      can anyone help? thanks in advance