The Flash platform has evolved over many years to provide an incredibly rich and engaging experience that can take advantage of the latest hardware that is available. The ActionScript Virtual Machine 2 (AVM2) introduced with Flash Player 9 offers a number of performance improvements over the AVM1 used by previous versions of the Flash Player, and technologies like Pixel Bender, introduced with Flash Player 10, provides developers with an even greater level of performance and flexibility. Away3D will quite often take advantage of these features transparently, but there are still a number of techniques that can be employed to increase the speed and responsiveness of an Away3D application.
This chapter will demonstrate a number of these techniques, including:
When we talk about the performance of an Away3D application, almost always we are referring to the number of frames per second (FPS) that are being rendered. This is also referred to as the frame rate. Higher frame rates result in a more fluid and visually-appealing experience for the end user. Although it is possible to visually determine if an application has an acceptable frame rate, it can also be useful to get a more objective measurement. Fortunately, Away3D has this functionality built in.
By default, when it is constructed, the View3D
class will create an instance of the Stats
class, which is in the away3d.core.stats
package. This Stats
object can be accessed via the statsPanel
property from the View3D
class. You can display the output of the Stats
object on the screen using the Away3D project stats option in the context (or right-click) menu of an Away3D application.
This will display a window similar to the following screenshot:
This window provides a number of useful measurements:
These values come in very handy when trying to quantify the performance of an Away3D application.