gskinner.com: gBlog: FlashMX 2004 source code, news, reviews and opinions
Back to gBlog Main gskinner.com website: source code, portfolio, etc. contact Grant Skinner

Syndication
RSS 1.0
RSS 2.0


Subscribe
Enter your email address to be notified when posts are added.

Search

Resources
Conference Session Notes

Flash Blogs
Waxpraxis
Philterblog
W3Blog
Jonas Galvez
Josh Dura
Quasimondo
Flashguru
Sean Voisen
Colin Moock
Flazoom
Greg Burch
Pope De Flash
Peter Hall
Glyn Thomas
actionscript.com
Princess Pegg


Aggregators
Flog
FullAsAGoog
MXNA
Hall of Justhese


« 'Tis the season: Snow FLA | Back to Main | Kermit Compromised! »

November 25, 2003


IMPORTANT NOTE: This is an old archive. It is only here to support outdated external links. To view the updated version of this archive, please go to the blog index, and search for the title of this document using the search form.

setStyle == Huge CPU drain
Posted by Grant

Sam Neff recently explored how setStyle notifies components of style changes, and the results are definitely worth noting (this may save you some major headaches, so listen up). It seems that every time you call setStyle, it calls notifyStyleChangeInChildren(), which iterates through EVERY movieclip in your movie, checking to see if it should notify it of the style change... ouch! Double-ouch even.

This was very useful information for me, as I'm presently working on a (top secret) project that has 100+ components instantiated at a time, and I was a little confounded as to why initializing the first interface was taking about 12 seconds. It all became very clear when I realized that I was setting about 40 different styles, which resulted in literally TENS of THOUSANDS of movieclip "style checks". Moving the setStyle calls to the first frame solved the problem completely.

The moral of this story: always set all of your global style information before instantiating ANY movieclips, and then don't change it - at least until Macromedia changes their EULA, and someone can legally distribute a fix for it (jab, jab). ;)

Posted @ 01:04 AM by Grant | TrackBack


Comments

Someone knows if MM is taking part in changing the EULA, that things only makes damage to Flash and his extension.

I hope MM don't take the same ways as Microsoft...

Posted by: Carlos Rovira at November 26, 2003 04:51 PM

The right post at right time. This really solves a few problems for me. thanks

Posted by: Simon Wacker at November 28, 2003 12:34 PM


Hosting by NetKeepers.ca | Powered by Movable Type 2.661
The text content of this blog is licensed under a Creative Commons License. Graphics are ©2003 Grant Skinner.