Tutorial by Examples

Vector based graphics are represented by a plethora of data that must be computed by the CPU (vector points, arcs, colors, etc). Anything other than simple shapes with minimal points and straight lines will consume vast amounts of CPU resource. There is a "Cache as Bitmap" flag that can b...
Rendering text consumes a lot of CPU. Fonts are rendered in a fashion similar to vector graphics and contain many vector points for every character. Altering text frame-by-frame will degrade performance. The "Cache as bitmap" flag is extremely useful if used correctly, meaning you must avo...
Using the Vector.<T> type and the for each loop is more performant than a conventional array and for loop: Good: var list:Vector.<Sprite> = new <Sprite>[]; for each(var sprite:Sprite in list) { sprite.x += 1; } Bad: var list:Array = []; for (var i:int = 0; i < ...
If you do not require an array to be in any particular order, a little trick with pop() will afford you enormous performance gains compared to splice(). When you splice() an array, the index of subsequent elements in that array needs to be reduced by 1. This process can consume a large chunk of tim...
Flash Player 10 introduced the Vector.<*> generic list type that was faster than the Array. However, this is not entirely true. Only the following Vector types are faster than the Array counterparts, due to the way they are implemented in Flash Player. Vector.<int> - Vector of 32-bit ...
Creating and configuring Sprite and TextField objects at runtime can be costly if you are creating hundreds of thousands of these on a single frame. Therefore a common trick is "pooling" these objects for later reuse. Remember we are not just trying to optimize the creation time (new Sprit...

Page 1 of 1