2 Replies Latest reply on Jun 6, 2007 11:09 AM by crazyjoemilan

    setInterval breaks down after many hours

      I'm using setInterval to reset a flash based museum kiosk. a setinterval function is called whenever someone proceeds past the main menu. Every time a button is clicked - the setinterval function continues but the counter in the function is reset. After three minutes of inactivity the swf will reset and go to the main menu and the interval is cleared.

      This seemed to work fine for a while . It has been one and half months and they do not reboot the computer. the reset function now resets after twenty seconds .

      any ideas?"
        • 1. Re: setInterval breaks down after many hours
          kglad Adobe Community Professional & MVP
          use getTimer() in a loop instead of setInterval() or use getTimer() in your called function to correct setInterval's call rate.
          • 2. Re: setInterval breaks down after many hours
            crazyjoemilan Level 2
            setInterval can stack on itself if you call it twice, it doesn't replace itself if you create another, even with the same name. So you can either use a different loop, like kglad suggests, or you can go a little overkill and force yourself to clearInterval everytime you call another. Also, use setTimeout when you can get away with it (its undocumented in AS2, but works just like setInterval, only it calls itself once instead of constantly).

            I currently alternate between those on my long-running app, and it seems to handle itself well. The only problem I run into with a monthlong app is when the cache gets full, it refuses to load in simple things from its own library. Frustrating :(