4 Replies Latest reply on Apr 6, 2009 9:08 AM by Rothrock

    Action Script 2

    Mitch5560

      I have a simple text animation(revolving text) it works fine althought i would like ti to pause for 5 seconds

      at completion in the second to last keyframe i added the following:

       

      stop();

      pauseAnim,=setInterval(this,"nextframe",5000);

       

      i added a final keyframe and added this to it:

      clearInterval(pauseAnim);

      play();

       

      it does not re-start as expected instead it stops and thats it,,,,, i need it to restart after 5 seconds?????

      What simple thing am i miossing here???

       

      Thanks

        • 1. Re: Action Script 2
          Rothrock Level 5

          That would be because the method you are looking for is "nextFrame" -- the capitzalization makes a difference.

           

          I also assume the ,= is just some kind of hinky thing with the forums, because there shouldn't be a comma between pauseAnim and the equal sign.

           

          On a few points of refinement. You should declare your pauseAnim variable with a

           

          var pauseAnim:Number;

           

          Also since you are only using the pause once and then clearing it I would recomment using setTimeout() instead.

          • 2. Re: Action Script 2
            Mitch5560 Level 1

            Could you explain a little further here ???

            Example please....

             

            Thanks

            • 3. Re: Action Script 2
              Mitch5560 Level 1

              Sorry if i am not clear the "F" fixed the issue thanks

              could you explain what you meant with an example??

               

              Thanks

              • 4. Re: Action Script 2
                Rothrock Level 5

                setInterval generally means, "Do this repeatidly at the delay I specify." Which, if after the first time you call it you do a clearInterval means it only gets called once. setTimeout means, "Just do this thing once and that is it. So you won't need to clearInterval.

                 

                setTimeout(this,"nextFrame",5000);

                 

                You can do the same thing with the returned value, like this:

                 

                var pauseAnim:Number=setTimeout(this,"nextFrame",5000);

                 

                And then if you need to stop that timeout before it goes you can

                 

                clearTimeout(pauseAnim);

                 

                But it will only go one time and after that you don't need to clear it. Does that make sense?