Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does AS3 Event.ENTER_FRAME run on every frame, always? Even on slow computers?

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?

like image 498
zechdc Avatar asked Jan 20 '23 07:01

zechdc


1 Answers

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

like image 104
Michael Antipin Avatar answered May 10 '23 18:05

Michael Antipin