Archive for August, 2009

Caching timeline objects in Flash

Saturday, August 8th, 2009

Grant Skinner‘s talking about a Flash feature request that seems to make a lot of sense. It got me thinking about a problem I’ve experienced with Flash in the past, and whether it deserved anyone’s attention at Adobe. I decided that it did.

A lot of programmers new to AS3 reach a point, as I did, when they get very jumpy about their projects’ memory usage. It’s kind of a rite of passage, and during mine, I discovered that a set of animated buttons I incorporated into a GUI were spewing out gobs of display list garbage. (Display list garbage consists of DisplayObject instances, whose references to parents and children make them difficult for the garbage collector to quickly eliminate, kind of like digesting cellulose. For more on garbage collection, I’d suggest you conduct a hexosearch.)

Imagine your Flash animator friend makes you a MovieClip that represents a flashing bulb. She has probably made it go on and off by having a blank keyframe (lightbulb off) and a filled keyframe (lightbulb on) in a top layer in the Flash timeline, with the lightbulb outline in a bottom layer. Because the timeline is short, it will loop frequently, causing the bulb to flicker. (more…)