3 Replies Latest reply on Jun 6, 2011 4:36 PM by kglad

    High-speed Timer in Actionscipt?

    dsnyder12345 Level 1

      i'm trying to time things in flash and need a high-speed timer with resolution of somewhere around 10 to 100 microseconds.  the closest thing i have found so far is the "time" component of Date.  that has a resolution of about 16 milliseconds and therefore is too coarse for what i need.

       

      thanks,

      doug

        • 1. Re: High-speed Timer in Actionscipt?
          kglad Adobe Community Professional & MVP

          you can't count on any timing in flash being ms-accurate.

           

          what you see is dependent on your local computer system.  what another user of your swf sees is dependent on their local system so, even if you get timing accurate to within 10ms on your system, it does not mean anyone else will see the same.

           

          that said, increasing your frame rate and using the timer class (as3) or setInterval (as2) will generate the quickest loops suitable for timing and using getTimer() is more accurate than the timer/setInterval delay parameter.

          • 2. Re: High-speed Timer in Actionscipt?
            dsnyder12345 Level 1

            i tried setting the frame rate faster (1000Hz), but it maxed out at the monitors frame rate (60Hz) - which kinda explains the resolution of Date.time

             

            the high-speed timer only has to be consistent on my system.  i'm using the timer for performance testing and won't need it in a "shipping" environment.

             

            doug

            • 3. Re: High-speed Timer in Actionscipt?
              kglad Adobe Community Professional & MVP

              then set your frame rate to 120, don't put anything on stage and use the timer class or setInterval() with getTimer() to do whatever you want.