Ludicrous Software

Optimization Tip: Use Graphic Symbols

Speaking for myself, having started Flash development on the desktop, there are a few bad habits that carried over into my mobile development work. Given the vastly different capabilities and specifications of mobile devices, this can create problems later on. So, it’s best to nip these bad habits in the bud - it makes things much easier on yourself if you optimize your code and assets from the start, rather than have to spend hours going through your application trying to find areas in need of improvement.

One bad habit of mine was that whenever I would create symbols, I would always make them movie clips, and not consider if they would work just as well as graphic symbols. My thinking had probably been that if I needed to manipulate these symbols via ActionScript, then they’re pretty much ready to go. The downside to this is that movie clip symbols have a significantly larger memory footprint than graphic symbols, due to their built-in methods and properties.

If you’re writing an application with a large number of assets on the stage, that memory consumption can really add up. In one instance, I had a main movie clip that contained a number of keyframes with different movie clips on each frame, representing different states of the main clip. The main clip was being manipulated by the code, not the child clips, so the children didn’t need to be movie clips. I found that converting all of the movie clips that didn’t need to be movie clips into graphic symbols saved about 150k of memory (according to Device Central). That’s a huge savings on pretty much any mobile device.

In short, and with apologies to William Lyon Mackenzie King:** “Movie clips if necessary, but not necessarily movie clips.”

(**That might not make sense if you’re not Canadian!)