Sham Bhangal is an author of and contributor to numerous books on Flash and ActionScript, including Foundation ActionScript for Flash MX, Flash MX Designer's ActionScript Reference, and Macromedia Flash MX Upgrade Essentials.
This content is excerpted from the above-named O'Reilly publication, with permission, by agreement with ActionScript.org.
Hacks #65-73
Optimize Filesize and Download Time
Optimize Graphics
65. Beat Flash File Bloat
Why the Big File?
The Fix
Final Thoughts
66. Bandwidth Testing for Complex Sites
Final Thoughts
67. Hide Low-Quality Settings
Use Noncontrasting Colors
Use Horizontal/Vertical and Fast-Moving Shapes
Use Pixel Fonts
Final Thoughts
68. Optimize Graphics for Performance
Design with Speed in Mind
Create and Test Optimized Graphics
Final Thoughts
69. Benchmark Runtime Performance
Final Thoughts
70. Adjust the Animation Complexity Dynamically
Calculate the Achieved Frame Rate
Adjust the Complexity Based on Performance
Final Thoughts
71. Performance Budget
Areas of Focus
Set Process Priorities
Implementation
Final Thoughts
72. Substitute Bitmaps for Vectors
Example One: Bitmaps Move Faster than Do Vectors
Example Two: Avoid Antialias Calculations
Final Thoughts
73. Optimize Component Downloading and Usage
Final Thoughts
Hacks #65-73
Flash's
animation
engine isn't the fastest one around because the
Flash Player is optimized for a small download size, not for
performance. Also, it is designed with web use in mind; therefore, it
is optimized for small, low-bandwidth files rather than large,
complex animation. In order to maintain its small footprint and
ensure maximum compatibility, the Flash Player does not support
hardware acceleration. Therefore, performance issues are often
paramount for the Flash designer.
Three areas of possible optimization in Flash are as follows:
Reduce download time by creating efficiencies in content filesizes or
changing the way content is downloaded [Hack #73]
Increase animation performance by optimizing graphics for fast redraw
Increase computing performance by writing code that executes quickly
Each point is considered in greater detail next.
Optimize Filesize and Download Time
Flash started off as a simple
vector-based web animation plugin but is now routinely used for more
bandwidth-heavy applications. Take care to ensure that the user is
not kept waiting for content to load. The only way to ensure the
lowest possible wait times is to test your site often during
production.
Prior to the Flash MX 2004 Version 7.0.1 update, the built-in
Bandwidth
Profiler offered little help in modeling realistic web conditions for
sites using multiple SWFs or other external assets. Although the
latest version can test multiple SWFs and account for externally
loaded assets, it still does not properly handle shared fonts, nor
does it allow you to test your site from within a browser.
Third-party tools [Hack #66] help
overcome the limitations of the Bandwidth Profiler and enable you to
test the whole site (i.e., both Flash and non-Flash assets) under
bandwidth-limited conditions using the browser.