Chapter 6. Symbols, Instances, and the Library

IN THIS CHAPTER

  • Working with library panels in Flash: The Document Library and External Libraries

  • Organizing your Library and resolving conflicts

  • Defining content types and managing assets

  • Understanding basic symbol types: Graphic symbols, Button symbols, Movie Clips

  • Linking and updating symbols with authortime shared libraries

Symbols are the key to file size efficiency and interactive power in Flash. A symbol is a reusable element that resides in the current movie's document Library, which you access with Window

Symbols, Instances, and the Library

Using symbols helps reduce the file size of your finished movie because Flash needs to save the symbol only once. Each time a given symbol is used in the project, Flash refers to its original profile. To support the variations of an instance, Flash needs to save information about the differences only — such as size, position, proportions, and color effects. If a separate graphic was used for each change, Flash would have to store a complete profile of all the information about that graphic — not just the changes, but also all of the points that specify what the original graphic looks like.

Furthermore, symbols can save you a lot of time and trouble, particularly when it comes to editing your movie. That's because changes made to a symbol are reflected in each instance of that symbol throughout the movie. Let's say that your logo changes halfway through production. Without symbols, you would have to find and change each copy of the logo. However, if you've used symbol instances, you need only edit the original symbol — the instances are automatically updated throughout the movie.

Tip

The pattern drawing tools in Flash CS5 — Spray Brush and Deco — are an excellent use of symbols. Using multiple instances of a symbol to create a pattern enables you to quickly change the look of even complex patterns by editing the original symbol.

In this chapter, you learn to create and edit basic symbol types stored in your Document Library. You also learn to use symbol instances, both within the Main Timeline and within other symbols, and to modify individual instances of a symbol.

Understanding the Document Library

The Library (

Understanding the Document Library

The main document Library panel, shown in Figure 6.1, is used to access stored assets for any files that are currently available in the tabbed Document window. Each file has its own unique Library list that displays all symbol assets used in the file as well as any assets that were imported or added to the Library to be saved with the file.

Tip

The Flash Library panel includes a drop-down menu that provides quick access to the Library list of any project files (.fla) loaded into the Document window. Changing the view within the main Library panel is faster and more space efficient than opening and managing multiple Library panels.

Tip

All Library panels can be scaled vertically and horizontally by clicking and dragging the sides or the bottom of the panel. Panels can be docked to any other Library panel or to the Properties panel or the Document window — wherever you find it most convenient to keep your source symbols handy.

The main document Library panel provides access to assets for open .fla files (top left). Common Libraries (bottom) and other saved .fla files (top right) can be opened as External Libraries and used as asset source files.

Figure 6.1. The main document Library panel provides access to assets for open .fla files (top left). Common Libraries (bottom) and other saved .fla files (top right) can be opened as External Libraries and used as asset source files.

Working with Common Libraries and External Libraries

External Libraries are panels that open separately from the main Library panel to provide access to stored assets for files that are not currently open in the Document window. You can open any saved Flash file as an External Library by choosing File

Working with Common Libraries and External Libraries

Flash ships with three External Libraries called Common Libraries. These panels hold ready-made elements that you can drag into any document Library (or onto the Stage or Pasteboard in an open Document Window) to use in your own projects. Common Libraries behave exactly like any other External Library. Choose Window

Working with Common Libraries and External Libraries

Tip

Preview sounds by selecting them in the Library list and then clicking the play button in the preview window.

You can open and use the Common Library panels and any other External Library panels as free-floating panels (as shown in Figure 6.1) or you can stack or group them for tabbed access (as shown in Figure 6.2). After you copy assets to one of the document asset lists in the main Library panel (or into any of your project files in the Document window), you can close the External Library and work with the copied symbols without changing the original symbol source.

You can organize Common Libraries and External Libraries into panel stacks (left) or tabbed groups (right).

Figure 6.2. You can organize Common Libraries and External Libraries into panel stacks (left) or tabbed groups (right).

A helpful feature in all Flash CS5 Library panels is a new search field (as shown in Figures 6.1 and 6.2). You will find it right above the asset list marked by a small binocular icon. You can type the name of a specific element or just the first letter of the elements you want to find and sort in the asset list; as you type, Flash shows you all elements that match the information you are entering. For example if you type in b, you might see "flowerButton," "symbol2," "BeamScan," and so on — anything with the letter b in the name. If you typed the full word bu you would see only "flowerButton" in the asset list. This feature can save a lot of time if you are sorting through a complex file with many elements stored in the Library. The search even looks in folders and shows you any matching items.

Tip

To add your own buttons, symbols, or even complete libraries for specific projects, first save them in a Flash document (.fla) with a descriptive name; then place that Flash file in the Libraries folder within the Configuration folder for Flash CS5 on your hard drive.

The source files for the External Libraries that show up in the Common Libraries menu are stored in the Libraries folder of the Configuration folder for Flash CS5.

  • The standard directory path on Windows is:

    C:Program FilesAdobeFlashCS5 (language)ConfigurationLibraries
  • The standard directory path to the application config folder on Mac is:

    HDApplicationsAdobe Flash CS5(language)ConfigurationLibraries

Working with multiple Document Libraries

The Flash Library panel, shown in Figure 6.3, includes a drop-down project menu that lists all currently open files. This is a great space saver that makes it much easier to switch between different document Libraries without having to manage separate floating panels. By default, the Library panel switches views as you tab from one document to another in the Document window, but changing the Library view does not change the Document view — in other words, the Library panel is connected to the Document panel but not the other way around. This makes it easy to access a different Library while maintaining the view of your current file in the Document window.

If you want to keep a Library asset list for one project visible in the Library panel while tabbing to a different project file in the Document window, you can use the handy Pin toggle in the Library panel. Click the tack or pushpin icon to pin or "stick" the current asset list so it won't change when you tab to a new project in the Document window. Don't forget to click the Pin toggle again to turn it off when you want to unstick the Library asset list.

There are times when you may want to see the contents of more than one Library at a time — to compare files or to drag items from one Library to another. Click the New Library Panel button to create a duplicate floating Library panel at any time. You can then use the drop-down menu to switch the project view in one of the Library panels to compare items or to drag the contents of one Library to another. Like External Libraries or other floating panels, Document Library panels can be grouped (for tabbed access), stacked, or floated as individual panels.

You can access elements stored in the Library of any other Flash document (without opening the actual .fla file in the Document window) by choosing File

Working with multiple Document Libraries
The Flash document Library panel includes a project menu, Pin toggle, and New Library button. As shown, you can use the New Library Panel button to launch a clone panel (right) for the current project view in the main Document Library (left).

Figure 6.3. The Flash document Library panel includes a project menu, Pin toggle, and New Library button. As shown, you can use the New Library Panel button to launch a clone panel (right) for the current project view in the main Document Library (left).

You can copy assets from an External or Common Library to a current Document Library by dragging items from the source Library onto the current document Stage, or directly into the Library panel. This also works if you have two documents open, and you want to move assets between the two Libraries. It is also then possible to drag or copy and paste elements directly from one document Stage onto another or drag an item from a source document Stage into a current document's Library.

Note

Open documents are loaded into the tabbed Document window. If you want to view more than one Document Stage at a time, use the Window

The Flash document Library panel includes a project menu, Pin toggle, and New Library button. As shown, you can use the New Library Panel button to launch a clone panel (right) for the current project view in the main Document Library (left).

The shared Library feature makes it possible to link assets between project files (.fla) during production by using authortime sharing, or to link multiple published movie files (.swf) on the server with runtime sharing. Shared libraries create a more optimized workflow than saving individual copies of assets in multiple documents. You can learn more about linking symbols in your project filesin "Using Authortime Shared Libraries" later in this chapter.

Reading the Library panel

Every Flash document has its own Library panel, which is used to store and organize symbols, sounds, bitmaps, and other assets such as video files. As shown in Figure 6.4, the item highlighted — or selected — in the Sort window is previewed in the Preview window. Each item in the Library has an icon to the left of the name to indicate the asset type. Click any heading to sort the window by Name, Kind (type), Use Count, or Linkage (all headings shown in Figure 6.1).

The Document Library (scaled to a narrow view)

Figure 6.4. The Document Library (scaled to a narrow view)

If the item selected in the Library is a Button symbol, a Movie Clip, or a sound file with more than one frame on its timeline, a controller appears in the upper-right corner of the Preview window. This Preview Stop/Play controller pops up to facilitate previewing these items. It's equivalent to the Play command in the options menu. As shown in Figure 6.5, the library options popup menu lists a number of features, functions, and controls for organizing and working with items in the Library.

The Library panel and the options popup menu

Figure 6.5. The Library panel and the options popup menu

The following commands, found in the Library options menu, enable you to add or modify content stored in your document Library:

  • New Symbol: Choose this command to launch the Create New Symbol dialog box where you can name and choose properties for a symbol, and then click OK to open Edit mode and place or create graphics on the symbol timeline. When a new symbol is created, it is stored at the root of the Library Sort window. You can drag it inside of any existing Library folders.

  • New Folder: Items in the Library can be organized in folders. The New Folder command simply creates a new folder within the Sort window. New folders are "untitled" by default; double-click the folder text to type a custom folder name. This menu command is equivalent to the New Folder button at the bottom of the Library panel.

  • New Font: Use this command to open the Font Symbol Properties dialog box, which is the first step in creating a font symbol for use within a Shared Library.

  • New Video: Creates a new empty Video object in the Library.

  • Rename: Use the Rename command to rename the currently selected item in the Sort window. Double-click any item title in the list to achieve the same thing.

  • Delete; Duplicate: Select Duplicate to create a copy of an item and Delete to delete an item in the Sort window.

  • Move to: Use the Move to option to open the Move to dialog box. You can move the currently selected element to an existing folder in your Library list or create a new folder (which will appear in your main Library list) to move it to.

Note

You can also move Library items to folders by dragging them onto any folder icon.

  • Edit: Choose Edit to access the selected symbol in Edit mode.

Tip

Double-clicking a symbol on the Stage takes you into Edit in Place mode, a variant of Edit mode that enables you to see other elements on the Stage dimmed in the background for layout reference as you modify the symbol.

  • Edit with: Provided that you have appropriate external applications installed, most imported assets (such as sounds, bitmaps, and vectors) have this command available to jump to the external editing environment of your choice.

  • Properties: This command opens the related Properties dialog box for the particular symbol type — Sound, Bitmap, Symbol, Component, or Video Properties. The Properties dialog box is a central control that enables you to rename an element, access Edit mode, or access the Linkages dialog box from one location. This is also where you can define or edit the Source for any element.

  • Play (or Stop, if currently playing): If the selected asset has a timeline or is otherwise playable (such as a sound), click this to preview the asset in the Library Preview window. If the asset is currently playing, this option is updated to Stop — in which case, click to stop playing.

  • Update: Use this option if you've edited items subsequent to importing them into Flash. Items update without the bother of re-importing. You can also use this option to swap in a new element of the same kind to replace an item already used in your project.

  • Properties: Use this command to open the Properties dialog box for the currently selected item (Symbol Properties, Sound Properties, Bitmap Properties, Font Symbol Properties, Video Properties, or [Component] Linkage Properties).

  • Component Definition: This library option opens the Component Definition dialog box, which you use to assign parameters to Movie Clips to create your own components or modify parameters for compiled components. (Components are Movie Clips with customizable behavior that can be reused in projects.)

Tip

You can also use the Component Inspector panel to set component parameters.

  • Shared Library Properties: Use this command to open the Shared Properties dialog box, which is another aspect of runtime Shared Libraries.

  • Select Unused Items: Select Unused Items to find any items stored in the Library that have not been used in the current project.

Tip

Unused items are not included in your published movie file (.swf), but they add weight to your project file (.fla). The Select Unused Items command is a handy way to find these files so you can delete them to streamline your project file. Use Save and Compact or Save As to save your .fla file minus the extra weight of the unused items that you have deleted from the Library.

  • Expand Folder/Collapse Folder: Use this command to toggle the currently selected folder in the asset window open or closed.

  • Expand All Folders/Collapse All Folders: Use this command to toggle all folders and subfolders in the asset window open or closed.

  • Help: Launches a Web browser to access Adobe help with info on Managing Assets in Flash or the local Flash help documents (if you are not connected to the Internet).

Selecting New Symbol, Duplicate, or Properties from the options menu while you have a symbol (Graphic symbol, Button symbol or Movie Clip) selected in the Library list launches the Symbol Properties dialog box, as shown in Figure 6.6. Use this dialog box to change the symbol's name and/or behavior (as a symbol type — Graphic, Button, or Movie Clip).

Note

If you choose the Properties option with other asset types selected, such as sound, video, or bitmaps, the Properties dialog box relevant to each item type launches rather than the Symbol Properties dialog box.

The Symbol Properties dialog box. Note the button for Advanced options — this expands the dialog box to include Linkage and Source information for the selected element.

Figure 6.6. The Symbol Properties dialog box. Note the button for Advanced options — this expands the dialog box to include Linkage and Source information for the selected element.

Organizing Library panels

When your movies start to become complex, you'll find that the Library gets crowded, and it can be hard to find symbols. When this happens, you'll appreciate the capability to create and name folders for your symbols. You can organize your Library folders however you like, but here are a few suggestions for greater productivity:

  • Create a separate folder for each scene.

  • Create folders for symbol types, such as buttons, sounds, or bitmap imports.

  • Store all symbols or graphics that relate to a specific element (such as a logo or an animated element) together in one folder.

Tip

The Search field included in all the CS5 Library panels is a wonderful tool for finding and organizing assets and should save beleaguered developers a bit of time and frustration.

When you build complex layered structures in your movie — a Movie Clip symbol on the first frame of a Button symbol, with a text symbol on the layer above it, and a sound on the layer above that — the Library doesn't visually track this hierarchy. But you can indicate this: Just put all the associated symbols in a folder with a name that describes the final element. You can also nest folders within other folders. Working with folders in the Library is almost exactly the same as working with folders in the Layers area of the Timeline window, as follows:

  • To create a folder, click the folder icon at the bottom-left corner of the Library.

  • To move a file or folder into another folder, simply drag it over the target folder icon.

  • To move a folder that's been nested within another folder back to the top level of the Library, drag the folder until it is just above the Library list and over the word Name and release.

Note

Putting symbols in different folders does not affect the links between them and their instances (as opposed to the way moving a graphic file into a new folder breaks an existing link on a Web page). Flash tracks and updates all references to Library items whenever you rename or move them into separate folders (within the same Library).

The Movie Explorer is a great way of getting a visual overview of the nested relationship of symbols, Movie Clips, and other items within your document. Refer to the end of this chapter for more on the Movie Explorer.

Warning

If you change the Undo behavior in your Flash Preferences from Document-level to Object-level, you'll lose the option to undo some authoring steps. For example, any item that is deleted from the Library is gone forever, including all instances throughout the current document (.fla). If you decide that you shouldn't have deleted an item, the only cure is to close the file without saving any changes. When you reopen the file, the Library should be intact as it was the last time the file was saved.

Tip

Flash offers an option to Import to Library that is especially useful when you want to bring in a series of items. Instead of having all the items dumped onto the Stage in your Document window, you can load them directly into the project Library. Select File

Resolving Conflicts between Library Assets

Defining Content Types

Understanding the behavior of various media types and learning to streamline asset management unlocks the true potential of Flash for combining compelling content with small file sizes. The basic structures for storing, reusing, and modifying content within a Flash project are not complicated, but the reason for using various symbol types does deserve explanation.

Raw data

When you create graphics directly in Flash, using the shape tools, text tool, or any of the other drawing tools, you produce raw data or primitive shapes. You can copy and paste these elements into any keyframe on the timeline, but they do not appear in the project Library. Each time the element appears, Flash has to read and render all the points, curves, and color information from scratch because the information is not stored in the Library. Even if the shape looks exactly the same on keyframe 10 as it did on keyframe 1, Flash has to do all the work to re-create the shape every time it appears. This quickly bloats the size of the .swf file. Also, because each element is completely independent, if you decide to make any changes, you have to find and edit each appearance of an element manually. This is a daunting task if your project involves animation or nested symbols.

Tip

The Find and Replace feature (Option/Alt+F) makes it easier to accomplish mundane editing tasks on multiple items within your Flash project file. I introduce the myriad uses for Find and Replace in Chapter 9, "Modifying Graphics."

Tip

If you want to convert a raw graphic into a drawing object after it has been created, select the graphic on the Stage and apply the Modify

Raw data

Drawing objects and shape primitives

You create drawing objects by turning the Object Drawing option toggle on in the Tools panel while using any of the drawing or shape tools. (This option is on by default, so if you haven't touched the toggle in the Tools panel, you will find yourself creating drawing objects when you use any of the drawing tools to make graphics.) Drawing objects have some of the characteristics of raw shapes and groups. They can be modified directly on the Stage (without having to click in to Edit mode) but they are self-contained and do not merge with or cut into other graphics on the same layer — unless you apply one of the Combine Objects commands. They can't be motion-tweened and they are not stored in the Library unless they are converted into one of the symbol types. The hybrid characteristics of drawing objects suit some workflows very well, but some graphic artists prefer to work in normal or Non-Object Drawing mode. Drawing objects can be combined seamlessly with raw graphics and symbols, and turning the Object Drawing option on or off does not have any effect on graphics you have already created.

The Oval Primitive and Rectangle Primitive tools provide another way of making basic shapes with the advantage of using controls in the Properties panel that can be changed or reset even after the shapes are drawn. Like drawing objects, shape primitives do not merge with or erase other shapes, but they are not stored in the Library.

Warning

Shapes or lines made with the Drawing Object toggle turned on and shapes made with the Oval and Rectangle Primitive tools have some special behaviors in the authoring environment, but like basic shapes and groups, drawing objects and shape primitives are not stored in the Library unless they are converted into symbols. Symbols are the only method of storing artwork that reduces the file size impact of graphics that occur on more than one frame of a Flash movie.

Groups

One step toward making raw data more manageable is to use groups. By grouping a filled shape with its outline stroke, for example, it becomes easier to select both parts of the shape to move around in your layout. If you added a text element that you also wanted to keep aligned with your artwork, you could add this to the group as well. Groups can be inclusive or cumulative so that you can select multiple elements and create one group (

Groups

The important thing to remember about groups, however, is that they are not symbols. Although groups have a similar selection highlight to symbols, you will notice that they don't have a crosshair icon in the center, and that the group information won't appear in your project Library. No matter how careful you are about reusing the same raw data and grouping elements to keep them organized, when it comes to publishing your movie (.swf) or trying to update any single element, you will be no better off than if you had just placed raw elements wildly into your project. Flash still treats each shape and line as a unique element, and the file size grows exponentially each time you add another keyframe containing any of your raw data, even if it is grouped. The best way to use groups in your project is for managing symbols, or to organize elements that you plan to keep together and convert into one symbol.

Warning

Using groups helps organize raw shapes or other elements in your FLA files, but it does not help to optimize the final SWF file. Using a lot of groups in your project file can actually add weight to the final published .swf.

Native symbols

Imported sound, video, bitmap, or font symbols are stored automatically in the Library to define instances of the asset when it is used in the project. In addition, three basic container symbol types can be created in the Flash authoring environment: Movie Clip symbols, Graphic symbols, and Button symbols, which all have timelines that can hold images, sounds, text, or even other symbols. Although it is possible to make the behavior of a symbol instance different from the behavior of the original symbol, it is generally best to decide how you plan to use a certain element and then assign it the symbol type that is appropriate to both its content and expected use in the project.

Tip

Dragging a primitive shape or group into the Library panel from the Stage automatically opens the Convert to Symbol dialog box so that you can name and assign a symbol type to the element before it is added to your Library.

To make a decision on what type of symbol to use, it helps to have a clear understanding of the benefits and limitations of each of the symbol types available in Flash. Each symbol type has specific features that are suited to particular kinds of content. Each symbol type is marked with a unique icon in the Library, but what all symbols have in common is that they can be reused within a project as symbol instances, all defined by the original symbol. A Flash project Library may contain any or all of the symbol types in the following sections, all created directly in Flash.

Graphic symbols

Graphic symbols are used mainly for static images that are reused in a project. Flash ignores any sounds or actions inside a Graphic symbol. Graphic symbols do not play independently of the Main Timeline and thus require an allocated frame on the Main Timeline for each frame that you want to be visible within the symbol. If you want a Graphic symbol to loop or repeat as the Main Timeline moves along, you have to include another whole series of frames on the Main Timeline to match the length of the Graphic symbol timeline for each loop.

A drop-down Options menu in the Properties panel enables you to control Graphic symbol playback. Select a Graphic symbol instance in your document and open the Looping section of the Properties panel to access the three settings in the Options menu:

  • Loop: This is the default setting for Graphic symbols. If the Graphic symbol extends along a timeline beyond its original length, the symbol restarts from the beginning. Graphic symbol looping does not play independently of the Main Timeline like Movie Clip looping — you still have to match the number of frames on the Main Timeline with the number of frames that you want to play in the Graphic symbol timeline.

  • Play Once: This setting eliminates looping by allowing the Graphic symbol timeline to play, and then holding on its last frame if it extends along a timeline beyond its original length.

  • Single Frame: This setting holds the Graphic symbol on one frame so that it behaves like a static graphic. You can select a specific frame within the Graphic symbol timeline to display as the static graphic. The appearance of the Graphic symbol is the same regardless of how far it extends along a timeline.

Movie Clip symbols

Movie Clips are actually movies within a movie. They're good for animations that run independently of the movie's Main Timeline. They can contain actions, other symbols, and sounds. You can also place Movie Clips inside of other symbols, and they are indispensable for creating interactive interface elements such as animated buttons.

Movie Clips can continue to play even if the Main Timeline is stopped. Thus, they need only one frame on the Main Timeline to play back any number of frames on their own timeline. By default, Movie Clips are set to loop. So, as long as there is an instance of the Movie Clip visible on the Main Timeline, it can loop or play back the content on its own timeline as many times as you want it to, without needing a matching number of frames on the Main Timeline. Movie Clip playback can be controlled with ActionScript from any timeline or even from an external code (.as) file.

Button symbols

Button symbols are used for creating interactive buttons. Button symbols have a timeline limited to four frames, which are referred to as states. These states are related directly to user interaction and are labeled Up, Over, Down, and Hit. Each of these button states can be defined with graphics, symbols, and sounds. After you create a Button symbol, you can assign independent actions to various instances in the main movie or inside other Movie Clips. As with Movie Clips, Button symbols require only one frame on any other timeline to be able to play back the three visible states (frames) of their own timeline.

Components

Components are prebuilt Movie Clips for interactive Flash elements that can be reused and customized. Each component has its own unique set of ActionScript methods that enable you to set options at runtime.

Imported media elements

A Flash project Library also stores certain types of imported assets to define instances of the asset when instances are used in the movie. You can place these imported assets into native Flash symbol structures by converting a bitmap into a Graphic symbol or placing a sound inside a Button symbol, for example.

Bitmaps

Bitmaps are handled like symbols: The original image is stored in the Library and any time the image is used in the project it is actually a copy, or an instance, of the original. To use a bitmap asset, drag an instance out of the Library and onto the Stage. You manage Export settings for individual bitmaps from within the Library by choosing Properties from either the contextual menu or the Library options menu. However, you cannot apply color or alpha effects or any Flash filters to the bitmap instance unless you convert it into a native Flash symbol type (Graphic, Button, or Movie Clip).

Vector graphics

Vector graphics, upon import from other applications, arrive on the Flash Stage as a group, and unlike bitmaps may be edited or manipulated just like a normal group drawn in Flash. These elements are not stored in the Library until they have been converted to a native symbol type.

Warning

In previous versions of Flash, vector graphics consisting of drawing objects or shape primitives could be motion-tweened without being converted into symbols, but the new tweening workflow in Flash CS5 requires symbols for motion tweening. If you try to apply a motion tween to an element that is not already a symbol, you will be prompted by a dialog box to convert it or cancel the tween. Although drawing objects and shape primitives have benefits in the authoring environment, they do not get stored in the Library and have the same impact on file size as other raw vector graphics.

Sounds

The Library also handles sounds like symbols. However, they can be assigned different playback behavior after they are placed on a timeline. Flash can import (and export) sounds in a range of sound formats. Upon import, these sound files reside in the Library. To use a sound, drag an instance of the sound out of the Library and onto the Stage. You manage export settings for sound files within the Library by choosing Properties from either the contextual menu or the Library options menu. You can define playback behavior and effects with the Properties panel after placing a sound on a timeline.

Note

Importing and using sounds effectively is a critical topic I cover in Chapter 14, "Adding Sound."

Video assets

Video assets, as with font symbols, can be embedded or linked. Embedded video assets, like bitmaps, can have color, alpha, and filter effects applied if they are first converted to a native Flash symbol type.

Note

Flash supports alpha channels in video files. This opens up a whole range of exciting options for integrating video with other Flash content. For comprehensive coverage of working with video in Flash CS5, refer to Chapter 14, "Displaying Video."

Font symbols

Font symbols are symbols created from font files to make them available for use in dynamic text fields. Font symbols can also be defined as shared fonts to make them available to multiple movie files (.swf) without the file size burden of embedding the font into each file individually.

Editing Symbols

Because every instance of a symbol is linked to the original, any edit applied to that original is applied to every instance. There are several ways to edit a symbol, which I cover in the following sections.

Modifying a symbol in Edit mode

Edit mode opens the Stage and timeline of the selected symbol in the Document window, replacing the view of the current keyframe in the Main Timeline with a view of the first keyframe in the symbol's timeline. To open a symbol in Edit mode, do one of the following:

  • Select an instance on the Stage and choose Edit

    Modifying a symbol in Edit mode
  • Select an instance on the Stage and right-click (Command/Ctrl+click), and then choose Edit from the contextual menu.

  • Select an instance on the Stage and use the shortcut key (

    Modifying a symbol in Edit mode
  • Double-click a symbol in the Document Library. (Double-clicking bitmaps, sound, video, and other nonnative symbol types launches the Properties dialog box instead of opening Edit mode.)

Editing a symbol in a new window

This method is useful if you're working on two monitors and want to quickly open a new window to edit in while keeping a view of the Main Timeline open and available. On Mac, these two windows are always separate, but you can click either window to switch back and forth. On Windows, you can switch between these windows by choosing from the Window menu.

To edit a symbol in a new window, select an instance on the Stage and right-click (

Editing a symbol in a new window

Editing a symbol in place

The advantage of Edit in Place is that, instead of opening the symbol in a separate edit space, you can edit your symbol in context with the surrounding movie. Other elements present on the current keyframe are visible but dimmed slightly and protected from any edits you make on the selected symbol. To edit a symbol in place, do one of the following:

  • Select an instance on the Stage and choose Edit

    Editing a symbol in place
  • Select an instance on the Stage and right-click (

    Editing a symbol in place
  • Double-click the instance on the Stage.

Editing symbols from the Library

You might not have an instance of your symbol available to select for editing in the Document window, but you can still edit it. Just edit it from the Library. Open your movie's Library with Window

Editing symbols from the Library
  • Double-click the symbol's icon (not its name) in the Library list.

  • Right-click (

    Editing symbols from the Library
  • If you have opened the Symbol Properties dialog box (see Figure 6.6), you can move to Edit mode by clicking the Edit button.

Returning to the Main Timeline or scene

After you edit your symbol, you'll want to go back to the scene in the Main Timeline to make sure that your changes work properly. Just do one of the following:

  • Choose Edit

    Returning to the Main Timeline or scene
  • Double-click in any empty area of the Edit Stage.

  • Click the Return arrow at the left edge of the Edit bar to step back through any nested timelines until you reach the Main Timeline.

  • Select the scene name in the left corner above the Stage view in the Document window, as shown in Figure 6.7.

    The location label in the Document window Edit bar is used to identify the current edit space and to return to the Main Timeline of the current scene.

    Figure 6.7. The location label in the Document window Edit bar is used to identify the current edit space and to return to the Main Timeline of the current scene.

Modifying Instance Properties

Every instance of a symbol has graphic variables that you can modify. These properties apply only to the specific instance, not to the original symbol. Display properties such as brightness, tint, and alpha (transparency) can all be modified without creating a new symbol. An instance can also be scaled, rotated, and skewed. Filters and blend modes enable a range of cool visual effects that you can apply to symbol instances. With the Type menu in the Properties panel, you can also change the symbol type behavior of an instance without changing the original symbol. As I previously discuss, any changes you make to the original symbol in Edit mode are updated in each instance. This still holds true even if some of the instances also have properties that are modified individually.

Note

Scaling, rotating, and skewing in 2-D space is kinda fun but the 3-D tools in Flash CS5 enable you to move or rotate a symbol in 3-D space. Use the 3D Rotation or 3D Translation tools to modify symbol instances along the x, y, or z axis to create the illusion of depth on your Flash Stage. 3-D tools are discussed in more detail in Chapter 9, "Modifying Graphics".

Applying basic color effects to symbol instances

Each instance of a symbol can have a variety of color effects applied to it. The basic effects are changes of brightness, tint, and alpha (transparency). Tint and alpha changes can also be combined for special effects. To apply color effects to a symbol instance by using the Properties panel:

  1. Select the instance in the Document window that you want to modify.

  2. Select one of the options from the Style drop-down menu in the Color Effect section of the Properties panel. Figure 6.8 shows the basic color effect options that can be applied to any symbol type.

    The color effect Style menu has basic options to choose from (left). After a color effect is selected, the settings for that effect are available in the Properties panel (right).

    Figure 6.8. The color effect Style menu has basic options to choose from (left). After a color effect is selected, the settings for that effect are available in the Properties panel (right).

The options available from the color effect Style menu are as follows:

  • None: No effect is applied.

  • Brightness: Adjusts the relative brightness or darkness of the instance. It ranges from 100 percent (white) to −100 percent (black); the default setting is 0 percent (no visible change to instance appearance). Use the slider to change the value or just type a numeric value into the entry field.

  • Tint: Enables you to shift the color of an instance. Either select a hue with the color picker or enter the RGB values directly, and then select the percentage of saturation (Tint Amount) by using the slider or by entering the percentage in the entry field. This number ranges from 0 percent (no saturation) to 100 percent (completely saturated).

  • Alpha: Enables you to modify the transparency of an instance. Select a percentage by using the slider or by entering a number directly. The Alpha percentage (or visibility setting) ranges from 0 percent (completely transparent) to 100 percent (no transparency).

  • Advanced: When you select the Advanced option from the Style menu, numeric values appear in two columns that enable you to adjust both the tint and alpha settings of an instance. The controls on the left reduce the tint and alpha values by a specified percentage, whereas the controls on the right either reduce or increase the tint and alpha values by a constant value. The current values are multiplied by the numbers on the left and then added to the values on the right.

Note

The Advanced option includes a range with negative alpha values. Potential uses for this capability, together with more information about using color effects and other methods of transforming symbol instances, are detailed in Chapter 9.

Changing the symbol type of an instance

You don't need to limit yourself to the native behavior of a symbol. For example, there may be times when you want a Movie Clip to have the behavior of a Graphic symbol so that you can preview animation by scrubbing the Timeline. You don't have to go through the extra effort of creating a new symbol — just use the following steps to change the type of the instance as needed:

  1. Select the instance in the Document window you want to modify.

  2. From the symbol Type drop-down list at the top of the Properties panel, select the desired behavior. As shown in Figure 6.9, you can assign Graphic, Button, or Movie Clip behavior.

    You can change the behavior of any selected symbol instance with the drop-down symbol Type menu in the Properties panel.

    Figure 6.9. You can change the behavior of any selected symbol instance with the drop-down symbol Type menu in the Properties panel.

Note

The more-complex uses of symbol instances are covered in Part V, "Adding Basic Interactivity to Flash Movies."

Swapping symbols

You may need to replace an instance of one symbol with an instance of another symbol stored in your project Library. Luckily, you don't have to go through and re-create your entire animation to do this — just use the Swap Symbol feature, illustrated in Figure 6.10. This feature only switches the instance of the symbol for an instance of another symbol; all other modifications previously applied to the instance remain the same. Here's how to swap symbols:

  1. Select the instance that you want to replace.

  2. Click the Swap symbol button in the Properties panel, choose Modify

    Swapping symbols
  3. Select the symbol that you want to put into the place of your current instance from the list of available symbols in your project Library.

  4. Click OK to swap the symbols.

Use the Swap Symbol dialog box to choose a replacement for a symbol instance without losing any transformations that have already been applied.

Figure 6.10. Use the Swap Symbol dialog box to choose a replacement for a symbol instance without losing any transformations that have already been applied.

Building Nested Symbol Structures

Understanding the various symbol types individually is the first step, but the next step is integrating these building blocks to create organized, optimized Flash projects that are extensible, easy to edit, and fast to build. Although I cover the workflow for different types of Flash projects in other parts of this book, I can synthesize the overview of different symbol types by walking through the steps of creating a Button symbol with some nested animation and Graphic symbols.

To demonstrate building an animated Flash movie from various symbol types, I made a Button symbol called basicButton that uses some raw shapes, some Graphic symbols, and some Movie Clips, all nested inside a Button symbol timeline.

Note

The starting source file (sampleButton.fla) for this series of demonstrations is on the CD-ROM that accompanies this book in the ch06 folder.

Converting a raw shape into a Graphic symbol

The best way to begin creating any graphic element is to first consider the final shape that you need and to try to find the most basic primitive shapes that you can use to build that element. Keep in mind that instances can be scaled, skewed, and adjusted with color effects. Instead of drawing three circles to make a snowman, you would make just one circle and convert that into a symbol so that you could build your snowman from scaled instances of just one symbol stored in the Library. A resourceful animator I know built a Christmas tree by reusing instances of a symbol he had made for a dog's tail in the same animation — a wagging tail and a tree all built from just one Graphic symbol stored in the Library! Raw graphics can be converted into Graphic symbols after they have been drawn, or you can first create a new Graphic symbol and then draw the raw shapes directly inside the Graphic symbol in Edit mode — either way, the end result is a contained visual element that is stored in the Library to define any instances that you need to place in your movie.

To build the simple graphics used in basicButton, you can begin by converting a raw shape into a Graphic symbol:

  1. Select the Oval tool and set the fill color to green and the stroke color to black with a stroke height of 3.

  2. Click on the Stage and hold down the Shift key while dragging out the shape to create a perfect circle. Double-click the fill with the Selection tool to select both the stroke and the fill, and then use the Properties panel to set the width to 75 and the height to 75. (If the Constrain check box is selected in the Properties panel, you only need to enter 75 in one of the value fields and the circle will scale evenly.)

    Tip

    An alternative workflow supported in Flash for creating an oval (after completing Step 1) is to Option/Alt+click in the Document window to open the Oval Settings dialog box. Enter 75 for the width and height of the circle and click OK. Flash renders a circle in the Document window, centered on the point you clicked.

    Note

    If you open the Library panel — Window

    Converting a raw shape into a Graphic symbol
  3. While the stroke and the fill are both still selected, press F8 or choose Modify

    Converting a raw shape into a Graphic symbol
  4. In the Convert to Symbol dialog box, choose Graphic for the symbol type and give the symbol the name plainCircle. Click OK. You should now see the plainCircle symbol with the Graphic symbol icon next to it in the Library panel.

Tip

You always have the choice of creating artwork on the Main Timeline and then converting it into a symbol or first inserting a new symbol and then creating artwork in the symbol drawing space. Either workflow achieves the same end result. In the plainCircle example, start by selecting Insert

Converting a raw shape into a Graphic symbol

You can now reuse instances of this Graphic symbol in your document in as many places as you need it just by dragging an instance onto the Stage from the Library panel.

Note

For the basicButton example, you will need an instance of plainCircle inside of a new Button symbol rather than on the main Stage, so you can delete any instances of plainCircle from the Main Timeline before continuing with additional steps.

Using Graphic symbols in a button

Button symbols are similar to Movie Clips that have a special timeline structure linked to mouse states. For a button to take you to a new point on the Main Timeline or to load any other elements, ActionScript must be added to the button instance.

Note

I discuss adding actions to buttons for more advanced interactivity in Chapter 15, "Understanding Actions and Event Handlers."

In this example, the button simply works as a structure for an animation that reacts to the mouse. Begin by inserting a new Button symbol:

  1. Click the New Symbol button in the Library panel or choose Insert

    Using Graphic symbols in a button
  2. In the Create New Symbol dialog box, choose Button as the symbol type, and for this example give the symbol the name basicButton. Click OK. This Button symbol is now stored in the Library and automatically opens in Edit mode in the Document window, so you can add some content to the button.

    You will notice that the Button Timeline shows four keyframes with labels that define the button state by mouse behavior: Up, Over, Down, and Hit. These various keyframes can have multiple layers and contain any visual element or sound that you want. The button states function as follows:

    • Up: Any elements placed in the Up keyframe are associated with the button as it appears on the Stage when the button is present but not activated by any mouse interaction.

    • Over: Any elements placed in the Over keyframe are associated with the button when the mouse rolls over it on the Stage, but as soon as the mouse rolls off the button it reverts to its Up state.

    • Down: Any elements placed in the Down keyframe are associated with the button only when the mouse is over it and clicked and held down. As soon as the mouse is released, the button reverts to its Over state.

    • Hit: The Hit keyframe is actually never visible on Stage, but this instead defines the area of the button that is "sensitive" to the mouse. Whatever shape is present on this frame is considered part of the button's hit area. It is important to note that it is better not to have holes or gaps in the hit area unless it is intended. For example, if you have text as a button, it is best to use a solid rectangle that matches the width and height of the total text area. Using the actual text would result in an irregular button hit area — whenever the mouse rolls into the space between letters, the button would revert to its Up state and could not be clicked.

    Tip

    If you ever need an "invisible" button in your project, you can create one by adding artwork to the Hit keyframe only of a Button symbol. The button is visible in the authoring environment as a bright blue preview shape (defined by the graphics in the Hit state), but when the .swf file is published, the only indication that a button is on the Stage is the change in the mouse cursor when it enters the Hit area. You can add ActionScript to an invisible button to trigger events in your animation or to control the behavior of other elements in your movie. I discuss invisible buttons in more detail in Chapter 15, "Understanding Actions and Event Handlers."

    For this example, you create animation to be placed into the various visible states, but the main shape of the button will always be consistent, so you can begin by creating a layer to define the main shape of the button.

  3. Rename Layer 1 of the Button symbol timeline as buttonOutline and insert two frames (F5) after the first keyframe to create a span of three frames (visible for Up, Over, and Down).

  4. With the playhead set on the first keyframe, drag an instance of plainCircle onto the button Stage and make sure that it is now visible in the Up, Over, and Down states of the button, but not on the Hit state.

  5. Center the instance on the button Stage by using the Align panel (

    Using Graphic symbols in a button
  6. Select the instance of plainCircle and copy it to the Clipboard (

    Using Graphic symbols in a button
  7. Create a new layer and name it hitArea.

  8. Insert a blank keyframe (F7) on frame 4 (Hit). To paste the copy of plainCircle into the center of the blank Hit keyframe, use Paste in Place (

    Using Graphic symbols in a button

    The timeline of your Button symbol should now look like Figure 6.11.

  9. Return to the Main Timeline by clicking the Scene 1 label in the Edit bar or by double-clicking an empty area of the Stage.

  10. If you don't see an instance of your basicButton on the Stage of the Main Timeline, drag an instance out of the Library and place it on the first frame of the Main Timeline.

The Edit mode view of the basic Button symbol timeline, with Up, Over, Down, and Hit states defined with instances of the plainCircle Graphic symbol

Figure 6.11. The Edit mode view of the basic Button symbol timeline, with Up, Over, Down, and Hit states defined with instances of the plainCircle Graphic symbol

Animating Graphic symbols in a Movie Clip

After you have created some Graphic symbols to define your basicButton, you can now start building some animation to add to it. You can build animation by placing artwork in keyframes on the Main Timeline, but this limits how you can use the animation and can make it difficult to add more elements to your project without disturbing the keyframe structure of the animation. If you need animated elements that can be reused, and quickly moved to different parts of the Main Timeline or placed into a Button symbol timeline, it is best to begin by creating a Movie Clip.

  1. Click the New Symbol button in the Library panel or choose Insert

    Animating Graphic symbols in a Movie Clip
  2. In the Symbol Properties dialog box, choose Movie Clip as the symbol type and give this symbol the name overAnim.

  3. Create a new circle on the first frame of the Movie Clip Timeline with a black stroke (with a height of 3) and no fill. Select the outline with the Selection tool and use the Properties panel to set its width and height to 25. Then use the Align panel to center it on the Stage.

  4. Convert this raw shape into a Graphic symbol (Modify

    Animating Graphic symbols in a Movie Clip
  5. Insert nine frames (F5) on the Movie Clip Timeline so that you have a span of frames from frame 1 to frame 10 with the outline Graphic symbol visible.

  6. Select the instance of outline on the Stage in frame 1 and right-click/Ctrl+click and select Create Motion Tween from the contextual menu. (Or use the Application menu to select Insert

    Animating Graphic symbols in a Movie Clip
  7. Now select the instance of the outline in frame 10 and use the Properties panel to change the width and height of the outline to 50 pixels high and 50 pixels wide. The graphic should stay centered on the Stage, but you can use the Align panel to make sure.

    You should now be able to drag the playhead from frame 1 to frame 10 in the timeline and see an animation of the outline growing in size. Figure 6.12 shows the view of the outline instance on frame 10 with a tween from frame 1 to frame 10.

    The symbol timeline of the Movie Clip "overAnim" showing a motion tween of the Graphic symbol "outline," from frame 1 to frame 10

    Figure 6.12. The symbol timeline of the Movie Clip "overAnim" showing a motion tween of the Graphic symbol "outline," from frame 1 to frame 10

Adding a Movie Clip to a Button symbol

The final step in our example is to add the overAnim Movie Clip to the basicButton symbol. This is the secret to animated Button symbol: By nesting multiframe Movie Clip animations into the single frames assigned to the Up, Over, and Down states of the Button symbol timeline, you can create different animated "reactions" as the mouse rolls over or clicks the button.

  1. To go back inside your button and add animation in Edit mode, double-click the instance of basicButton on the Stage or the symbol in the Library.

  2. Create a new layer in the Button symbol timeline and name it outlineAnim. Make sure that this new layer is above the original buttonOutline layer.

  3. On the outlineAnim layer, insert a new keyframe (F6) on frame 2 (Over).

  4. Drag an instance of overAnim from the Library onto the button Stage in the keyframe you just created, and use the Align panel to center it.

  5. To ensure that the animation is visible only on the Over state of the button, make sure that the content on the overAnim layer occupies only one frame on the Button symbol timeline. If the overAnim symbol extends into frame 3, either insert a blank keyframe (F7) or remove a frame (Shift+F5) to keep it contained on frame 2.

    Your Button symbol timeline should now look like Figure 6.13.

You can test your Button symbol with this animation added to see how it is working by pressing

Adding a Movie Clip to a Button symbol
The timeline of the Button symbol basicButton with the Movie Clip overAnim placed on the Over keyframe of the outlineAnim layer

Figure 6.13. The timeline of the Button symbol basicButton with the Movie Clip overAnim placed on the Over keyframe of the outlineAnim layer

Modifying a MovieClip instance

Instead of creating an entirely new animation to display on the Over state of our basicButton, you can reuse the overAnim Movie Clip and change its appearance by adding a color effect to the instance.

  1. Double-click the basicButton symbol instance to enter Edit mode.

  2. Add a new layer to the Button symbol timeline and name it outlineAnimTint.

  3. Insert a blank keyframe on frame 3 (Down).

  4. Drag an instance of the overAnim Movie Clip from the Library, or just copy the Over frame on the outlineAnim layer and paste it into the blank keyframe you just created.

  5. Select the instance of the overAnim Movie Clip that you placed on the Down keyframe and, in the Color Effect section of the Properties panel, choose Tint from the Style menu.

  6. Choose white as the tint color from the Swatches that pop up from the color chip, and then enter a tint value of 100 percent by using the slider or by typing into the value box.

    Your Button symbol timeline should now look like Figure 6.14.

    The basicButton Timeline with an instance of the overAnim Movie Clip placed on the Down keyframe and modified with a color tint

    Figure 6.14. The basicButton Timeline with an instance of the overAnim Movie Clip placed on the Down keyframe and modified with a color tint

Test your animated button again (Ctrl+Enter/

The basicButton Timeline with an instance of the overAnim Movie Clip placed on the Down keyframe and modified with a color tint
The finished animated button as it appears in the Up, Over, and Down states

Figure 6.15. The finished animated button as it appears in the Up, Over, and Down states

You have seen how symbols are created, nested, and modified, and you are probably realizing that this basic animated Button symbol is only the beginning.

Note

If you want to deconstruct another layered symbol structure, I have included a silly, but slightly more complex, animated button on this book's CD-ROM. You will find the source file, surpriseButton.fla, in the ch06 folder. Figure 6.16 shows the three visible button states and diagrams the basic symbol nesting.

As your symbol structures get more layered and complex, it can be helpful to have some guidance when you are trying to navigate to a specific item in your project or just trying to remember exactly how you organized things as you were building. Although careful use of layer names, frame labels, and symbol names is indispensable, the Movie Explorer (introduced later in this chapter) is a great assistant for finding your way through the structure of any Flash document.

The animation as it appears in the three visible button states, Up, Over, and Down, with a diagram of the basic nested elements visible in each state

Figure 6.16. The animation as it appears in the three visible button states, Up, Over, and Down, with a diagram of the basic nested elements visible in each state

9-Slice Scaling for Movie Clip Backgrounds

Have you ever tried to resize the same background graphic to fit different content and found that the aspect ratio or corner angles were no longer consistent? This can be frustrating, and the workarounds in older versions of Flash — creating unique graphics for each use or manually splitting up scalable and nonscalable areas of a background or border — were time consuming and sometimes ineffective. The good news is that Flash includes a feature designed to solve this problem. The 9-slice, or Scale 9, option helps you selectively define the scaleable area of a Movie Clip to make it easier to transform and reuse.

To truly appreciate this feature you have to try it. Here's how:

  1. Create a new symbol in your Flash document (Insert

    9-Slice Scaling for Movie Clip Backgrounds
  2. Enter a name for your symbol and select Movie Clip as the symbol type.

  3. Select the check box to Enable guides for 9-slice scaling (shown in Figure 6.17).

    Enable guides for 9-slice scaling is an option in Advanced symbol properties.

    Figure 6.17. Enable guides for 9-slice scaling is an option in Advanced symbol properties.

    Tip

    Expand the Symbol Properties dialog box by clicking the Advanced button if you don't see the check box for 9-slice scaling.

  4. Click OK and enter the edit space for the new symbol; you'll notice a grid of dotted guidelines on the Stage. These four guides are used to split shapes into nine different regions (or slices) to control how the graphic is interpolated if the MovieClip instance is scaled.

    Don't worry about the guides just yet. Create your artwork on the Stage with any of the shape or drawing tools.

    Note

    The most common use for Scale 9 is to preserve the corners on rounded rectangles used as button icons. For our example, wI created a rounded rectangle by setting Fill and Stroke in the Properties panel, activating the Rectangle Primitive tool in the Tools panel, and then holding down Option (or Alt) and clicking on the Stage to open the Rectangle Settings dialog box. This makes quick work of creating a button icon — simply enter a width, height, and corner radius and click OK. The rectangle is drawn on the Stage for you.

  5. Make sure that your graphic is positioned in the center of the Stage. Select all elements and use the center horizontal and center vertical buttons in the Align panel with the To stage toggle turned on.

  6. When you have your graphic sized and aligned as you want it, click and drag the guides to position them so that the curved areas of your graphic are not distorted when the scaled instance is rendered. This is difficult to describe with text, but Figure 6.18 shows a centered rectangle with guides positioned to protect the rounded corners of the rectangle while allowing the center area of the graphic to be stretched when the symbol instance is scaled.

    You can drag the four slice guides to isolate the outside edges of a graphic that should be protected when the center area is stretched to scale.

    Figure 6.18. You can drag the four slice guides to isolate the outside edges of a graphic that should be protected when the center area is stretched to scale.

  7. To test the results of 9-slice scaling on your symbol, return to the Main Timeline and drag an instance of your symbol onto the Stage. Use the Transform tools or the Transform panel to change the size or aspect ratio of the symbol instance. I scaled the rounded rectangle symbol instance in our example horizontally to 150 percent.

Note

A symbol with 9-slice scaling enabled appears with the dotted grids in the preview pane of the Library panel. The grids are not visible when the symbol is placed on the Stage.

Tip

The effect of 9-slice scaling is visible in the authoring environment, so you don't have to test your movie to see the results of using this feature on a scaled Movie Clip.

The difference between 9-slice scaling and normal scaling is visible in the .fla and in the published .swf. As shown in Figure 6.19, the symbol without 9-slice scaling (left) is distorted when it's scaled larger, and the symbol with 9-slice scaling enabled (right) scales gracefully and preserves the original shape of the rounded corners.

Note

The example file shown in this section is also saved on the CD-ROM. Open 9Slice_symbolScaling.fla or .swf from the ch06 folder.

How does this magic happen? If the final symbol is scaled horizontally, the three center sections (from left to right) stretch while the corners and the top and bottom edges are constrained. If the final symbol is scaled vertically, the three sections (from top to bottom) stretch while the corners and the left and right edges are constrained. If the symbol is scaled in both directions, the t-shaped center section stretches to fit, while the corners remain protected. It might take a few tries to get the hang of using 9-slice scaling, but it saves you a lot of time if you need to design consistent scalable graphics.

The symbol with 9-slice scaling enabled is rendered consistently in the .swf without any distortion. The rounded corners at the original size (top right) match the rounded corners at the scaled size (lower right).

Figure 6.19. The symbol with 9-slice scaling enabled is rendered consistently in the .swf without any distortion. The rounded corners at the original size (top right) match the rounded corners at the scaled size (lower right).

You can enable 9-slice scaling when you create a new symbol, or you can enable it in the Symbol Properties dialog box for existing Movie Clip symbols — select the symbol in the Library list and choose Properties from the contextual menu or the panel Options menu.

Tip

If you create a Movie Clip with artwork first and then enable 9-slice scaling by accessing the Symbol Properties dialog box from the Library, the slice guides automatically align to the outside edges of your artwork. You may still need to adjust the guides to get the exact result that you want, but the starting point will be much closer than if you enable the 9-slice scaling guides before you create the artwork.

Using the Movie Explorer

The Movie Explorer panel is a powerful tool for deciphering movies and finding items within them. You can open it from the application menu by choosing Window

Using the Movie Explorer

Note

The Find and Replace command is a much more efficient choice if your goal is to dig up specific elements such as fonts or colors that you want to replace in your project file. I discuss the many uses of the Find and Replace feature in Chapter 9, "Modifying Graphics." I include coverage of the Movie Explorer here because it is still the best tool for discovering the structure of a file.

The Movie Explorer is an especially useful tool for getting an overview and for analyzing the structure of a Flash movie. This means that you can see every element in its relationship to all other elements, and you can see this all in one place. However, it's also useful for troubleshooting a movie, for finding occurrences of a particular font, and for locating places where you refer to a certain variable name in any script throughout a movie. As an editing tool, you can use it as a shortcut to edit any symbol, for changing the properties of an instance, or even for doing multiple selections and then changing the attributes of the selected items. Furthermore, the Find function is an incredible time-saver when working on complex project files.

Figure 6.20 shows the Movie Explorer as well as the Movie Explorer Settings dialog box, which you can open by clicking the Customize Which Items to Show button in the Movie Explorer (Customize is the far right icon in the row of filter buttons).

The Movie Explorer displaying the file structure for the button example created in the previous section

Figure 6.20. The Movie Explorer displaying the file structure for the button example created in the previous section

Filtering buttons

As shown in Figure 6.20, there are several icon buttons across the top of the Movie Explorer panel. These are called filter buttons, and they have icons representative of their function. Click any button to toggle the display of those elements in your file. Note, however, that the Movie Explorer's display becomes more crowded as you select more buttons, and that it performs more slowly because it has to sift more data. From left to right, the buttons filter the display of the following kinds of content:

  • Text

  • Button symbols, Movie Clips, and Graphic symbols (placed instances)

  • ActionScript

  • Video, sounds, and bitmaps (placed instances)

  • Frames and layers

  • The Movie Explorer Settings dialog box

Also note the Find field. It enables you to search through all items that currently appear in the Movie Explorer to find specific elements by typing in the name of the symbol, instance, font name, ActionScript string, or frame number.

The display list

Below the icons is a window with the display list. Much like Windows Explorer, or the Mac Finder, the Movie Explorer displays items hierarchically, either by individual scene or for all scenes. These listings are expandable, so if you have selected the Text button, an arrow (or on Windows, a plus [+] sign) appears beside the name of any scene that includes text. Clicking the arrow (or plus sign) displays all the selected items included in that scene. This type of visual data display is also referred to as a "tree structure." Clicking a plus sign (or arrow) expands a "branch" of the tree. At the bottom of the display list, a status bar displays the full path for the currently selected item.

In Figure 6.21, the Text filter button has been selected. As shown, clicking the arrow sign beside the Text icon in the display list shows the complete text, including basic font information.

The Movie Explorer for the surpriseButton example included on the CD-ROM, with the Text filter button chosen to view text and font information inside the file

Figure 6.21. The Movie Explorer for the surpriseButton example included on the CD-ROM, with the Text filter button chosen to view text and font information inside the file

The Movie Explorer Options menu

The Options menu is accessed by clicking the options triangle in the upper-right corner of the Movie Explorer panel. These commands enable you to control how much detail is shown in the display list and also to perform edits or revisions after you've found the specific items that you want to modify:

  • Go to Location: For a selected item, this transports you to the relevant layer, scene, or frame.

  • Go to Symbol Definition: This jumps to the symbol definition for the symbol that's selected in the Movie Elements area. (For this to work, both Show Movie Elements and Show Symbol Definitions must be toggled on.)

  • Select Symbol Instances: This jumps to the scene containing instances of the symbol selected in the Symbol Definitions area. (For this to work, both Show Movie Elements and Show Symbol Definitions must be toggled on.)

  • Show in Library: If the Library window is not open, this opens the Library and highlights the selected item. Otherwise, it simply highlights the item in the Library.

  • Rename: This enables you to easily rename selected items.

  • Edit in Place: Use this to edit the selected symbol in context on the Stage.

  • Edit in New Window: Use this to edit the selected symbol in Edit mode in a separate window from the main Document window.

  • Show Movie Elements: One of two broad categories for how filtered items are viewed in the display list, Show Movie Elements displays all elements in the movie, organized by scene.

  • Show Symbol Definitions: This is the other category of the display List, which shows all the items that are related to each symbol. Both Show Movie Elements and Show Symbol Definitions may be displayed simultaneously.

  • Show All Scenes: This toggles the display of Show Movie Elements between selected scenes and all scenes.

  • Copy All Text to Clipboard: Use this command to copy text to the Clipboard. Text may then be pasted into a word processor or into another editing application.

Note

I discuss text-related features in more detail in Chapter 8, "Working with Text."

Warning

Unfortunately, getting text back into Flash is not as easy as copying it to the Clipboard. If you copy a large amount of text to another application, you have to manually update individual text blocks in your Flash document to integrate any changes that were made to the text outside of Flash.

  • Cut: Use this command to cut selected text.

  • Copy: Use this command to copy selected text.

  • Paste: Use this command to paste text that has been copied from Flash or another application.

  • Clear: Use this command to clear selected text.

  • Expand Branch: This expands the hierarchical tree at the selected location; it's the menu equivalent of clicking the tiny plus (+) sign or right-facing arrow.

  • Collapse Branch: This collapses the hierarchical tree at the selected location; it's the menu equivalent of clicking the tiny minus (–) sign or down-facing arrow.

  • Collapse Others: This collapses the hierarchical tree everywhere except at the selected location.

  • Print: The Movie Explorer prints out, with all the content expanded, displaying all types of content selected.

You can also access the commands found in the Movie Explorer options menu via the contextual menu.

The contextual menu

Select an item in the Movie Explorer and right-click (/

The contextual menu

Figure 6.22 shows the contextual menu of the Movie Explorer. Among the most useful commands is the Goto Location option at the top. When you can't find an item (because it's on a masked layer or is invisible), this command can be a lifesaver.

The Movie Explorer's contextual menu

Figure 6.22. The Movie Explorer's contextual menu

When you are planning or looking for ways to improve a project, the Movie Explorer can provide an excellent map to the structure and function of what you've already accomplished. Whenever it's relevant, print out the Movie Explorer; this can function as project documentation for finished work, providing a reference of all scripting and Movie Clip placement. As such, it can make returning to a project months later much easier. It can also facilitate collaboration among developers, whether they share the same studio or need to communicate long distance. Finally, for all the reasons I listed in this chapter, you can also use the Movie Explorer as a tool for both learning and teaching.

Now that you have a handle on working with symbols in one project file, let's go to the next step and see how you can work with symbols in multiple Flash files.

Using Authortime Shared Libraries

Flash gives you two options for working with shared assets: authortime and runtime shared Libraries. Authortime sharing enables a development team to maintain consistency during production on multiple versions of a file or on various project files that use the same symbols by using a centralized internal source .fla file for fonts or other assets. Runtime sharing reduces file sizes and makes it easier to dynamically update content in projects that involve multiple .swfs without having to republish all the files. In runtime sharing, a Library of assets is created and published as a source movie (.swf) that is uploaded to the server to be shared with multiple linked movies (.swfs). Source assets in shared libraries can include any element that is normally created in a Flash movie, as well as assets such as bitmaps, fonts, sounds, or video that are imported and usually embedded in individual project files (.fla).

Runtime sharing involves URLs and linkage info, but authortime sharing is relatively simple and can be accomplished without even publishing any .swf files. You can update or replace a symbol in your current project (.fla) with any other symbol accessible on your local network. Any transformations or effects applied to instances of the symbol in your project file are preserved, but the contents of the symbol stored in the project Library are replaced with the contents of the new (or modified) source symbol that you choose to link to.

Note

For clarity, I will refer to the currently open .fla file as a project file, and the .fla that contains symbols that you want to link to as the source file. In real-world production, you can give the files any name you want. However, adding a special identifier such as "Library" or "Source" to the .fla filenames that you plan to use for sharing can help you (and your team) minimize confusion.

Note

I have included two sample files with some basic symbols that you can use to try out the symbol-linking feature. Both shapeProject.fla and shapeSource.fla are in the ch06 folder on this book's CD-ROM.

To link a symbol from one project Library to another, you need a source file and a project file. Open the project file and follow these steps:

  1. In the current project (or shapeProject.fla) Library panel, select the symbol (Graphic symbol, Button, or Movie Clip) that you want to link to a source symbol.

  2. Choose Properties from the contextual menu or from the Library options menu, and under Source in the Symbol Properties dialog box, click the Browse button to find the .fla file that contains the symbol you want to use as a source. After you find the .fla that will be your source, select it in the file list and click Open (as shown in Figure 6.23).

    The Select Source Symbol dialog box (shown in Figure 6.24) opens automatically to enable you to choose the specific symbol in the source library that you want to link to the symbol in your current project file.

    Tip

    You can also click the Advanced button in the Create New Symbol dialog box to access Source options and set linkage when you first create a symbol in your project.

  3. Select a symbol in the source Library file list and click OK to close the Select Source Symbol dialog box.

    Browsing for a source file in the Symbol Properties dialog box

    Figure 6.23. Browsing for a source file in the Symbol Properties dialog box

    The Select Source Symbol dialog box, where you specify a linked symbol

    Figure 6.24. The Select Source Symbol dialog box, where you specify a linked symbol

    Before you close the Symbol Properties dialog box, notice that the path to the source file is now listed and that you can select a check box for Always update before publishing (as shown in Figure 6.25). Select this check box if you want Flash to check for changes in the source file and automatically update all linked symbols each time you publish a .swf from the project file.

    The source path shown in the Symbol Properties dialog box with the Always update before publishing check box selected

    Figure 6.25. The source path shown in the Symbol Properties dialog box with the Always update before publishing check box selected

  4. Click OK to close the Symbol Properties dialog box. The symbol name in your project Library remains the same, but the content of the symbol in all instances used in your project file should now contain the updated content that will match the content of the symbol you chose in the source file.

  5. Save your project file to preserve the linkage information for your symbol.

Should any changes be made to the content of the symbol in the source .fla, you can either publish a .swf from the project file to see Flash automatically check for changes and update all linked symbols (with the Always update before publishing check box selected in the Symbol Properties dialog box), or you can use the Update command to manually get the most recent version of the symbol into your project file before you publish a .swf. To see how this works, follow these steps:

  1. Open the source .fla and make some changes to the symbol (using Edit mode) that you originally linked to and then save and close the file. You can change the appearance of the symbol, but don't change the symbol name.

  2. Open a project file that contains the symbol you want to update, and either ensure that the Always update before publishing check box is selected in Symbol Properties before publishing an .swf to force Flash to check for changes to the source symbol and automatically update your project Library, or go to Step 3.

  3. Select the symbol in the Library and use the options menu or the contextual menu to select the Update command.

  4. In the Update Library Items dialog box (shown in Figure 6.26), select the symbol that you edited in the source Library and click Update. You now see the content of the symbol in your project Library updated to reflect the changes made in the source file.

Use the Update Library Items dialog box to manually update the content of symbols in your project file.

Figure 6.26. Use the Update Library Items dialog box to manually update the content of symbols in your project file.

It probably seems like more hassle than it's worth to keep content current in one or two files, but you will find it very helpful should you need to update symbols in multiple project files consistently.

Summary

  • You can organize the Library with folders and symbols and rearrange assets without breaking their linkage to instances deployed within the project.

  • The Flash Library panel streamlines the controls for working with multiple documents. Instead of having to manage a separate Library panel for each open document, you can view different Library lists within a single panel.

  • The Flash CS5 Library can be docked and scaled like any other panel. The new search field at the top of the panel makes it easier to find items in complex project files.

  • Symbols are the building blocks of Flash. They save you time, reduce your file size, and add flexibility to your movies. When you use ActionScript to control symbol behavior or display, symbols are considered as objects within an object-oriented authoring environment.

  • Flash handles imported sounds, bitmaps, and video assets as symbols. They reside in the Library, and instances of these assets are deployed within a Flash project.

  • In addition to imported assets, there are three other kinds of symbols that can be created within Flash: Graphic symbols, Movie Clips, and Button symbols.

  • Movie Clip symbols and Button symbols have timelines that play independently from the Main Timeline. Although Graphic symbols also have their own timelines, they are still tied to the Main Timeline and require a frame for every frame of their own timeline that is visible.

  • Using symbol instances within a project is as easy as dragging an asset or symbol from the Library and onto the Stage, although it's usually best to have a new layer ready and to have the appropriate keyframe selected.

  • You can edit symbols a number of ways. Any edits to a symbol in Edit mode are reflected by all instances of that symbol throughout the project.

  • 9-slice scaling solves the problem of distorted graphics due to inconsistent scaling on multiple symbol instances. You can reuse and resize a rounded rectangle or pill button without worrying about mismatched stroke widths and stretched corners.

  • The Properties panel offers a central control for modifying individual symbol instances. You can modify the color and transparency of instances of a symbol via the Color Effect controls. Furthermore, you can reassign symbol types by using the Type drop-down menu and can even replace specific instances with other symbol instances by using the Swap symbol button.

  • The Movie Explorer is a powerful tool for navigating movies and finding specific items within them.

  • Shared Libraries streamline your workflow if a project involves multiple files that use assets that may need to be updated. Shared libraries are also useful for keeping files current and consistent in a team production environment.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset