O'Reilly logo

Essential ActionScript 3.0 by Colin Moock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Symbols and Instances

In the earlier section "Timelines and Frames," we learned that a .fla file is a hierarchy of one or more animations, each with its own timeline. Now that we've seen how to create the main animation in a Flash document, let's explore nested animations. In order to create nested animations, we must understand symbols.

In the Flash authoring tool, a symbol is a user-defined reusable animation, button, or graphic. Symbols are created off-Stage in a special symbol-editing mode. Each .fla file stores its associated symbols in an asset repository known as the Library. From a single symbol, an arbitrary number of copies, or instances, can be created. For example, to create a sky full of animated twinkling stars, we could create a single star symbol and then add multiple instances of it to the Stage. Figure 29-6 shows what the star symbol and its instances might look like in a .fla file. Notice that each star instance is positioned, scaled, and rotated independently.

The star symbol and star instances

Figure 29-6. The star symbol and star instances

By default, when a .swf file is compiled from a .fla file, only those symbols whose instances are actually used in the document (i.e., appear on Stage) or are exported for ActionScript (see the section "Instantiating Flash Authoring Symbols via ActionScript") are included in the .swf file. Furthermore, each symbol's content is included just once, and then duplicated ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required