Simple Counter Freezes (doesn't use loops)

I have a counter that continuously runs, updating how much CO2 emissions my clients product saves throughout the year (in real time). I’m using an onClipEvent (enterFrame){ and a this.onEnterFrame = function(){ within my code, but no loops like “for” or “while”. So I don’t think it could be a memory leak.

The client is complaining that it stops running randomly, but I was only able to get it to stop by running in the browser for 5 hours straight.

Is there something within the browser that could cause flash to stop running without that prompt of “code is causing machine to run slowly …do you want to continue running”?

If the browser isn’t within Windows focus …can the browser just randomly stop any plugins that are running?

ppgideascapes.com (it starts at the beginning of the year and speeds up to the current time)

As of now, I going to guess its a silent timeout …or my clients machines are ancient

http://blog.justgreat.nl/2007/08/24/joy-with-the-script-timeout-period/
http://www.zeuslabs.us/2006/03/01/you-can-catch-timeouts-and-stack-overflows-in-actionscript-3/

I suspect that it’s the combination of onClipEvent(enterFrame) and onEnterFrame that’s causing the problem.
The first is being triggered continuously at the frame rate of your movie…meanwhile, you’re also firing off an onEnterFrame which is also being triggered continuously at your frame rate.
In a nutshell, you’re telling Flash to update the entire stage at least twice as fast as your movie is playing.

You will almost certainly find it better to use setInterval to trigger the counter because you can control the exact rate at which the update occurs rather than relying on the frame rate of the movie (which will vary depending on the machine it’s being played on and what other processes are operating in the background).
Let’s assume your movie has a frame rate of 20 fps and you want your counter to be updated every second. One second = 1000 milliseconds
1000 milliseconds / 20 frames = 50 milliseconds
1000 milliseconds / 50 milliseconds = 20
Therefore, Flash is updating your movie (with just a single onEnterFrame) 20 times every second! With your two onEnterFrame’s it’s attempting to redraw the stage 40 times a second. It’s no wonder that your clients CPU is starting to lag.

However, if you used setInterval to update the stage every 1000 milliseconds, the Flash Player only redraws the screen once per second. For the remaining 999 milliseconds, that hard-worked CPU is able to work on all of the other important processes; like running the browser, Windows, swap-files, AV software, Office software…or whatever else they might have running in the background.

Thanks GlosRFC!