Recipe 3.17. Reusing Elements: Creating SymbolsProblemYou want to reuse an element in multiple places, use an element in a special capacity, such as a button, or simply optimize the use of timelines. SolutionConvert the element to a graphic, button, or movie clip symbol. DiscussionArchitecture is one of the most important considerations in any Flash movie. Architecture refers to the structure and organization of a movie. You should always strive, in Flash, to keep different elements separate from one another. Yet Flash offers a number of different ways to accomplish this goal. You have seen layers and groups in this chapter. But a far more flexible and powerful solution is to use Flash symbols. Flash symbols are reusable elements that have additional functionalities that vary by type of symbol. Symbols are reusable in that they are stored in a central repository in a movie, called the library. You can access the library by choosing Window Library in any movie. When a library symbol is placed on the stage, it is called an instance. Instances are linked to symbols in-as-much as the symbols are the blueprints for the instances. If you change any part of a symbol, all its instances throughout the movie are updated instantly. An instance can vary from its parent symbol in the values assigned to instance properties, such as scaling, opacity, placement, and a handful of others. In addition, instances have unique identifiers, called instance names. One benefit of symbols' reusability is that they minimize the impact on file size: no matter how many instances of a symbol exist in a movie, the symbol is only downloaded once. Reusability is only the beginning of the benefit of symbols. Other types of Flash elements, including imported bitmaps, sounds, and video, are stored in the library and may be reusable. But symbols extend the capabilities of Flash. Symbols make possible each of the following:
The implications of using symbols are too rich and varied to mention here. They form the substance of Chapters 9, 10, 14, and 15. Flash contains three common types of symbols, as follows:
New Flash developers are often unsure when to use movie clips as opposed to graphic symbols. Movie clips are much more powerful than graphic symbols, and they are generally preferred over graphic symbols. The exception is single-frame assets that you don't intend to manipulate via a script or use to trigger a script. Movie clips require (negligibly) more overhead than graphic symbols, so the latter still have a place in Flash. To use symbols, you must first create them, and then deploy one or more instances of them on the stage. Flash offers two common ways to create symbols, from scratch and converted from an existing element:
Symbols are stored in the library. To create an instance of a symbol, so it appears in the movie, drag the symbol from the library to the stage, in the desired layer and keyframe. To create multiple instances of a symbol, you can drag-and-drop as many times as you need, or you can copy and paste the instance. To edit a symbol, you can double-click its icon in the library or double-click an instance on the stage. Symbol editing mode opens. After you make changes and return to the movie, all instances are also updated.
See AlsoRecipe 4.1, Recipe 9.1, Recipe 8.13 |
Tripod >> 3pod Tips & Learning and manuals for educations