0 Replies Latest reply on Mar 9, 2008 8:24 AM by Curt King

    Analog clock MC -- how to produce accurate results?

    Curt King
      I'm using Flash 8.

      I am trying to program an analog clock movieClip -- if any of you have seen the UK game show "Countdown", it's a replica of the Countdown clock. It's a 30-second clock and the second hand runs from top ("12") to bottom ("6").

      My first crack at this has been timeline-based. I've used a motion tween to animate the hand moving from top to bottom. My movie is set to run at 12fps, but it's only running at ~11.3fps. Even though it's a slight deviation, it causes the clock to run about 32 seconds instead of 30. Note that during the animation, the CPU usage isn't exceeding about 4%.

      I do understand that you can't depend on the Flash Player to run at a particular framerate.

      So I changed the logic behind the clock to use setInterval(). Unfortunately, even my intervals aren't firing at the exact rate they need to. I've set the interval to 100ms, but it appears to be firing at 110ms or so. Even changing the intervals to a higher number (200ms, 500ms) don't produce exact results.

      Any ideas or suggestions on how I can make this work?

      Thanks,
      Curt