I have a script that relies on ENTER_FRAME
event to run every time. I have noticed on some slower computers there can be some lag when a flash movie is playing.
Does ENTER_FRAME
run on every frame, even if its on a slow computer?
If the flash movie lags, does the ENTER_FRAME
event still run and the rendering just try to catch up?
Is running code on ENTER_FRAME
a reliable way to execute code every time a frame is entered?
Yep. Every frame, no exceptions. If something is slowing a movie down (either heavy scripts or heavy graphics), it Event.ENTER_FRAME
handlers are still being executed before a frame is rendered.
Hence, it's generally a good idea to use a Timer
instance with TimerEvent.TIMER
, even if it's delay is set to be equal to 'ideal' frame duration for your movie's fps. Because timer
handler is not bound to be triggered at exactly uniform rate.
See the following link for more in-depth explanation: The Elastic Racetrack