1 Reply Latest reply on Feb 19, 2007 4:47 AM by MotionMaker

    get Timer() versus setInterval()

      I'm using get Timer() to pause animations before they start again but am worried that, having 8-10 of these in a movie, is not an efficient use of memory. Someone told me to use setInterval() instead. Does anyone know if that is a more efficient method? (for an application accessed online.)
      An eg of my code is:
      onClipEvent (load) {
      Count = getTimer();
      onClipEvent (enterFrame) {
      if (getTimer()-Count>2000) {

      The suggested replacement:
      turnInt = setInterval(this, "turn", 2000);
      function turn() {

      Thanks in advance for any info on this one.
        • 1. Re: get Timer() versus setInterval()
          MotionMaker Level 1
          Usage of memory is not likely an issue. The usage of CPU might be an issue but it is doubtful for 8-10 timers.

          However you can determine this yourself as a developer. You need to have a target environment for testing. Then you need to create a quick example to stress test the application. Then you test it on the live box with the environment targeted.

          The difference is onClipEvent is using the Movie's frame rate to check your state. The setInterval global function is using your milliseconds (2000) to check. The setInterval function can get a backseat if Flash needs processing power. See the interval argument at setInterval. Does not appear to be an deciding issue in your posted example.

          My preference is onClipEvent or the code version onEnterFrame for this example.