Optimizing Performance for the Adobe Flash Platform contains a treasure trove of tips on less obvious performance enhancements. For example, chapter 3, “Minimizing CPU usage”, highlights the following CPU management features:
- Pause and resume SWF files based on screen exposure: This is an automatic feature in Flash Player since version 10.1. Flash Player minimizes processing when SWF content goes off-screen.
- Instance management: This feature introduced the
hasPriorityHTML parameter. By default, Flash Player doesn’t start SWF content that is not visible. You can override this behavior in most cases by using the
- Sleep mode: On mobile devices, Flash Player and AIR detect when the device backlight goes into sleep mode. When this event occurs, rendering of SWF content stops, and frame rates drop to 4fps. Because the frame rate stays above zero, all open data connections can remain open.
- Freezing and unfreezing objects: You can use
ADDED_TO_STAGEevents to keep objects that are no longer in the display list from consuming unnecessary CPU cycles.
- Activate and deactivate events: By using events to detect when your application is activated or deactivated, you can reset the frame rate, freeze or unfreeze objects, or perform other CPU optimizations.
- Mouse interactions: Detecting mouse interaction on many objects simultaneously can be CPU-intensive. You can reduce that overhead by disabling mouse interactions on objects that do not respond to mouse events.
- Timers versus
ENTER_FRAMEevents: To execute code at specific intervals you can choose between a timer or
ENTER_FRAMEevents. The optimal choice for your situation depends on a number of factors, such as whether your application uses animation.
- Tweening syndrome: Minimize the use of tweens, especially for content intended for low-performance mobile devices.
Visit the Optimization Guide to find out more about these topics and many others, including memory management, efficient use of the ActionScript language, rendering, networking, and database access.