Performance optimization checklist for Flash Lite game / application development

Tips for optimizing ActionScript

  • Spread out initialization across movie and not all on Frame 1, doing to much in the first frame like slowdown the start of the application
  • Using gotoAndPlay() still loads content in the frames you skip, so use separate movie clips and link it via Actionscript
  • Garbage collection should occur every 60 seconds or on 20% memory spike, so manually remove objects and variables when they are no longer required, like clearing setIntervals, listeners etc., before removing movie clips for which it is assigned.
  • Variables local to functions are processed faster than global variables, so use the var keyword wherever possible.
  • Pre-calculate values using Math and store for access later, so try and minimize the use of Math and floating point numbers
  • Remove smaller loops and write each iteration separately
  • Use XML carefully and in small chunks, if possible, use simple name/value pairs for data. But light-weight data is good for your application and costs users less
  • Avoid using _alpha = 0, _visiblity = 0, instead hide remove MovieClips
  • Experiment with frame rates, starting with 10, 16, 24 or 32. Calibrate device profiles in Device Central CS4. Testing in Device Central CS4 gives 80% realistic performance as per the targeted device
  • Always test on a real device
  • Tips for optimizing visual assets

  • Optimize artwork prior to bringing it into Flash
  • Import gradients as bitmaps rather than vectors. Linear gradients easier to render than radial
  • JPG’s decompression can slowdown performance, so consider PNG’s wherever possible
  • Minimize areas of transparency inside PNG’s
  • Avoid rotating or scaling of bitmaps, Flash lite doesn’t support bitmap smoothing
  • If you are using vector shapes, try to keep simple as possible. Use Modify -> Shape -> Optimize
  • Corners and straight lines are easier to render than curves
  • Convert vector strokes and outlines to fills
  • Consider replacing small vector graphics with bitmaps
  • Use Graphic symbols over Movie clips where possible
  • Share