Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Timer vs ENTER_FRAME

This is a discussion on Timer vs ENTER_FRAME within the Tutorials forums, part of the Flash English category; Timer vs ENTER_FRAME This a good question? As we saw, we can use the Timer Class or the event Event....


Go Back   Forum Flash CS3 Flash CS4 > Flash CS3 Flash CS4 > Flash English > Tutorials

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 18-12-07, 06:27
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,535
Rep Power: 6
Flep is on a distinguished road
Timer vs ENTER_FRAME

Timer vs ENTER_FRAME


This a good question?

As we saw, we can use the Timer Class or the event Event.ENTER_FRAME to create animations.

But which one is best to use? Which method is more performing with the minimum CPU use for the user?


Let us look at a few facts to keep in mind?


If the application needs a change of frame rate


When a SWF is loaded into another SWF, the main SWF could have a different frame rate and (as we know that a loaded SWF inherits the frame rate of the main SWF) it could lead to have animations reproduced too slow or too fast.

In this case, the Timer Class offers the independence of the frame rate.


Using more instances of Timer requires more memory


In an application with a large number of animations, using the Timer Class requires more memory that the same number of animations created with the event ENTER_FRAME.

So it is advised, when we have more animations to run, to use ENTER_FRAME.


Using more instances of Timer can cause an excessive request of screen refreshes


In a Flash CS3 application, using a Timer, with the method updateAfterEvent() to check the animation of each object, would lead to an abnormal request to refresh the screen and so, there is a good chance to drive the user?s machine to its limit which would result in a drop of performance.


Based on those 3 facts described above, there are a few recommendations to obtain the best performance with a minimum effort:


- In applications that must synchronize animations created by Actionscript with animations created on frames of the timeline, to use Event.ENTER_FRAME

- In applications where the variations of the frame rate happen in runtime, to use a single and unique Timer to manage all the animations and their speeds.

- When the variations in runtime of the frame rate are considered acceptable, to use Event.ENTER_FRAME because the code to be used to create animations is generally simpler in comparison to the equivalent animation developed with the Timer Class.

- To avoid to use individual Timer to animate individual objects. Where possible, to use a single Timer that manages all the objects. This means that a unique Timer with a unique method UpdateAfterEvent() would be perfect.


See you soon!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Actionscript 3 swf esterni con enter_frame blade666 Actionscript 3.0 avanzato 10 21-12-08 12:09
Actionscript 3 Resettare timer Fedepag Actionscript 3.0 avanzato 0 21-06-08 10:51
Rendere pulsanti non cliccabili durante un Event.ENTER_FRAME dos Actionscript 3.0 base 2 21-03-08 15:20
Realizzare un Timer Eugene Actionscript 3.0 base 21 12-01-08 08:35
Meglio usare Timer o ENTER_FRAME per creare animazioni ? Flep Articoli e tutorials 2 13-11-07 11:48


All times are GMT. The time now is 12:10.

Powered by vBulletin version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap