Most of the power of Flash comes from its ability to create and manipulate symbols. A symbol is a master object that resides in one place—a panel called the Library—but can generate multiple copies of itself that can be used anywhere in Flash. Symbols offer a variety of advantages, including:
- Economy. If you have a visible object that’s intended to appear more than once in a Flash movie, you can convert it to a symbol. You can then place any number of instances (copies) of that symbol on the stage without any significant increase in the movie’s file size.
- Adaptability. Whenever you make a change in a symbol, that change is instantly reflected in all instances of the symbol.
- Flexibility. Every symbol has its own internal timeline. As a result, a symbol can contain its own animated content that plays independently of the animation in the main timeline.
- Nestability. Symbols can be embedded in other symbols, which can be embedded in still other symbols. By nesting symbols in this way, you can animate complex movements easily—for example, you could embed a symbol of a propeller turning inside a symbol of an airplane flying.
- Scriptability. Two kinds of symbols—buttons and movie clips—can be controlled using ActionScript. Movie clips can even include scripts of their own, allowing them to control other movie clips or the movie that contains them.
This chapter shows you the basics of creating, modifying, and organizing symbols. More advanced use of symbols is covered in Chapter 5 (Creating Basic Animation) and Chapter 11 (Introducing ActionScript).
#22. Converting Objects to Symbols
Any object (or group of objects) that can appear on the stage can be made into a symbol. Here’s how to do it:
- Select one or more objects on the stage. The selected objects may include paths, text objects, bitmaps, or even other symbols.
Choose Modify > Convert to Symbol, or press the F8 key. The Convert to Symbol dialog box appears.
(While this book usually doesn’t mention keyboard shortcuts, F8 is an exception because Convert to Symbol is such a frequently used command.)
- Enter a name for the symbol into the Name field.
- Click the radio button for the type of symbol you want to create: a movie clip, button, or graphic. (For the differences between these symbol types, see #27 and #28. If you’re experimenting with symbols for the first time, the simplest choice is Graphic.)
Click one of the small squares in the diagram next to the word Registration. The square you click will determine the symbol’s registration point (Figure 22a).
Figure 22a Click the square corresponding to your preferred location for the symbol’s registration point. Later, when you view the symbol in the library or in symbol-editing mode, your registration point will be indicated by crosshairs.
Think of the registration point as the handle by which Flash will hold the symbol when it’s in motion (see #42). When you’re in doubt, the center is usually a good choice.
You can find the symbol you just created in the library. (If the library isn’t part of your current workspace, choose Window > Library.) When you click the symbol’s name in the library list, you’ll see the symbol in the viewing pane above the list (Figure 22b).
Figure 22b Each symbol is listed in the library next to an icon representing the symbol type. You can click the name of a symbol to see what it looks like.
It’s also possible to create a symbol from scratch, without starting with an object on the stage. To do so, choose Insert > New Symbol. You’ll see a Create New Symbol dialog box, which is identical to the Convert to Symbol, except for the lack of a Registration diagram.
When you complete the dialog box and click OK, Flash enters symbol-editing mode (see #24). If you wish, you can create some visual content for the symbol; if you’d rather wait until later, click Scene 1 in the breadcrumb trail to return to normal mode. If you don’t create any content for the symbol, it will still be listed in the library, but the viewing pane will be blank when you click the symbol’s name.