1 Reply Latest reply on Apr 23, 2013 6:28 PM by Ned Murphy

    Flash Professional AS2 Countdown Timer

    WaltMichaelW

      Hello everyone, I have encountered a very strange problem.  I have created a countdown timer as part of a pacman game I am working on.  The actionscript is below.  When I run the SWF file, published or not, the timer counts correctly for the first two levels (both 30 seconds), but counts too quickly on the third level (45 seconds).  I've tried changing the countdown interval from 1000 up to 1000000 and down to 10.  It doesn't change the speed a lot when it's at 1000000, but at 10 it counts a lot faster.  I'm wondering if there is something wrong with the script I have, or a specific setting within Flash that has to be changed.  Any help would be greatly appreciated!

       

      clock = 45;

       

       

      countdown = function ()

      {

                clock--;

                if (clock == 0)

                {

                          clearInterval(countdownInterval);

                }

      };

       

       

      countdownInterval = setInterval(countdown, 1000);

       

       

      Also note that I have the following script on an object within the same frame, which I use to move to the next level once 500 or 750 points are reached.

       

      onClipEvent (enterFrame) {

                if (_root.score >= 750)

                {

                          _parent.gotoAndPlay(6);

                }

                if (_root.score <= 750 && _root.clock == 0)

                {

                          _parent.gotoAndPlay(7);

                }

       

       

      }

       

      Any ideas what could be wrong with the script or the document settings? If necessary I can upload the SWF or the FLA version of the document if that would help! Thanks in advance!