Before we continue further, let us take a moment to reflect on the trouble we might be getting ourselves into. Flash is an amazing platform from which to develop graphic-intensive applications. That being said, however, serious limits exist governing what is and what is not possible with Flash. This is important to keep in mind, especially when working with animation components, as every one of these components is leveraging computational resources to get the job done.
Here are some short tales of woe and slow.
Flash allows us to move graphics with a great amount of power and flexibility. It is fun to move things around in a virtual space, and it is the principal reason why I get excited about computer graphics. There are limits to how many things can be moving at the same time. In my years of working with Flash, I have found that about 30 simultaneously viewable moving objects is a comfortable number for almost all computers. In extreme situations, up to 100 simple or small objects can be successfully moved around with no slowdown.
Shut down (stop) objects when they are not moving.
Decrease the size and line complexity of the moving objects.
Move objects to where they need to go faster (bigger steps).
Remove objects no longer important to the scene.
Sometimes there are simply too many static graphic objects on stage. It is difficult to put a number on the amount of unmoving graphic objects that can safely be on stage, but for most computers, it is about 500. This is important to keep in mind, especially when working with our animation components, as they are actually composed of many small objects.
If duplicating a large number of instances, make sure they are defined as symbols.
Simplify objects that are instantiated multiple times.
Install more RAM!
Flash supports transparency well-very well, in fact. However, it does require quite a bit more processing power to handle an object with a transparent fill than an object with a solid fill. Astonishingly, the processing power required for transparent fills doubles with each overlapping layer. So for scenes where a large number of transparent objects are passing over each other, processing speed will be drastically affected.
Keep transparent objects from excessively overlapping, if possible.
Avoid using only "slight alphas" (for example, use 100% alpha instead of 96%).
Use solid color mixing to simulate transparency if transparency is not really needed (for example, use a gray instead of a transparent white fill over a black background).
Gradients are sweeping areas of averaged color that extend between well-defined points of color. The gradient is a computed fill. This means that every time a gradient requires drawing, the Flash player must stop and compute the values of the color bands for each pixel inside the region. For small objects, this isn't too much of a problem. When the object becomes large, filling a significant portion of the screen, you'll notice an immediate slowdown.
Develop your own gradients by creating many objects, each with a solid fill (the approach taken by this chapter).
Define your gradients with as few color points as possible.
Be selective about where gradients are used.
Limit the size of regions filled with gradients.
The problem with the text character is that oftentimes, it appears in large groups of characters, forming these wild things called words. The words are then seen getting together with other words, until before you know it, you've got a paragraph. The typical paragraph might have some 300 characters in it. This collection of text characters represents a very dense amount of information, both for the computer drawing the text and for the user reading it. Many new users underestimate the power and complexity of text and, for this reason, slow their programs down by moving it haphazardly all over the stage.
Change the quality of the text to low while moving it; set it back to high when still.
Use clean, efficient font outlines (i.e., no serifs or fancy fonts).
If possible, do not move text.
Through experience, you begin to understand the limits of your environment. Flash is no exception. If you are new to Flash, keep this short list of cautionary tales in mind, so that you might avoid crashes or slow-moving animations.