General Optimization Tips
Timeline frames and layers are two important parts of the Flash authoring environment. These areas show where assets are placed and determine how your document works. How a timeline and the library are set up and used affect the entire FLA file and its overall usability and performance.
- Use frame-based loops sparingly. A frame-based animation is dependent on the application’s framerate, as opposed to a time-based model which is not tied to FPS.
- Stop frame-based loops as soon as they are not needed.
- Distribute complex blocks of code across more than one frame if possible.
- Scripts with hundreds of lines of code will be just as processor intensive as timelines with hundred of frames based tweens.
- Evaluate content to determine whether animation/interaction can be easily achieved with the timeline or simplified and made modular using AS.
- Avoid using the default layer names (such as Layer 1, Layer 2), because it can be confusing to remember or locate assets when working on complex files.
- There are ways to combine transforms for better performance. For example, instead of nesting three transforms, calculate one matrix manually.
- If things slow down over time, check for memory leaks. Be sure to dispose of things which are no longer needed.
- At authoring time, avoid a lot of trace() statements or updating text fields dynamically as these consume performance. Update them as infrequently as possible (i.e. only when something changes rather than constantly).
- If applicable, place layers that include AS and a layer for frame labels at the top of the layer stack in the timeline. For example, it is a good and common practice to name the layer that contains AS actions.
- Do not put frame actions in different layers; instead, concentrate all actions in one layer. This will simplify management of AS code and improve performance by eliminating the overhead incurred by multiple AS execution passes.