Flash Optimizations of onClip enterFrame events
I’m going to be writing up a tutorial and exploring the benefits of what I am about to propose, this is for conversation and discussion.
When creating MovieClip objects that update their status every frame they enter, traditionally you bind a general loop to their “onClipEvent(enterFrame)” or other methods to bind to the onEnterFrame method.
Inside is normally a loop that executes perpetually with each frame refresh. When objects build up with this logic, the framerate in Flash movies can dwindle. This is especially evident on slower functioning computers.
I will be testing out a method to enhance movieclips who don’t need to always be looping. For example, if you have a navigational structure with 3 elements. Lets call them Home, News, and Contact. These navigational elements need to animate themselves when told to do so by the main flash animation.
Normally I would bind a method to “setTargetXY”, “doAnimation”, and let the main handler “onEnterFrame” handle the animation from there.
But what about when the movie isn’t moving the navigation around?
I propose the doAnimation should always have a “this.start()”. Additionally when the animation is over, the main handler should “this.stop();” to stop the moving from entering frames and continuously checking for an “isActive” or other qualifiers to begin animation calculations.
I’ve informally done this before just out of optimizing code, but I think a more formal approach may be beneficial.
Does anyone know if the flash player automatically does this? Tests for logical qualifiers in movie loops, and stops them until those qualifiers change?
It could be a nice optimization to the way Flash player handles static objects who have a loop with a single if statement wrapped around.
Related Posts
No comments yet.
Leave a comment
Featured Posts
- HTML Fadein Fadeout: Basic Javascript/AJAX Tutorial using jQuery's fadeTo
- Basic AJAX Tutorial: Smooth Scrolling Text Marquee with a jQuery plugin
- Basic AJAX Tutorial: jQuery toggle and slide
- Hosting: How to pick a WordPress Host
- Basic jQuery Tutorial: Modify CSS classes and attributes, Hover and Toggle example
Follow Me
Email Subscription
Recent Posts
Top Commentators
- No commentators.
Archives
Tags
Blogroll
- 456 Berea St
- ActionScript 3 Design Patterns
- adactio – home of Jeremy Keith
- ajaxian
- Boxes and Arrows
- Chris Brogan
- CSS Globe
- InsideRIA
- Jarrod Michael Studios
- Mad Vertices
- NETTUTS
- Portsmouth Community Calendar
- Roomware Blog
- Signal vs. Noise
- Six Revisions
- Snook
- Style Grind
- Tiago’s Weblog
- Viget Extend
- Vitamin
- Whats the latest
- Why Banks Fail
- Woork
- zupko.info
