Recipe 10.3. Dividing the Timeline into Segments


Problem

You have a lengthy timeline and want to divide it into logical sections.

Solution

Divide the timeline into scenes, frame segments, or movie clips.

Discussion

Movies with significant animation and video can have hundreds or even thousands of frames. To facilitate authoring, you may want to divide your timeline into segments. Flash offers several ways of dividing movies in time. Which you select depends on various factors, including which makes sense intuitively, whether and how you intend to implement ActionScript in the movie, and even more broadly, how you intend to architect the overall project.

Flash documents can have a maximum of 16,000 frames per timeline.


If you are an animator, and you are developing cartoons meant to be played from beginning to end in order, without user interaction, the traditional division of the timeline into scenes is probably a good option. Using Flash scenes, you can break the timeline into arbitrary sections, working on one at a time. At runtime, Flash plays the scenes back, without interruption, in order (though you can reorder scenes, as needed). From the point of view of ActionScript and Flash movie architecture, scenes are primitive and generally more trouble than they are worth. But for long, linear animations and videos that lack interactivity, scenes are a good selection.

Every Flash movie has at least one scenethe main timeline that appears when you create a movie. You can subdivide this timeline into multiple scenes; that is, the main timeline comprises all of the scenes that you create in a movie. The benefit of scenes is that they enable you to work on one portion of a movie at a time, without having to scroll through or worry about portions of the timeline outside your area of focus. A 2-minute movie, at 12 frames per second, has 1,440 frames. Divided into scenes, you can cause the main timeline to display a much more manageable number of frames at a time. Not only the number of frames is a factor; so is the number of layers. Typically, the longer a timeline, the more layers there are likely to be. And the content on any given layer may only be placed on the stage for a small portion of the entire timeline. The result is that you can end up with large numbers of layers, and at any given point along the timeline, the majority of the layers do not contain any visible elements. If you divide the timeline into scenes, the number of layers per scene can end up much more manageable as well.

The only timeline you can break into scenes is the main timeline. You may not break the timelines within symbols into scenes.


To create a new scene, choose Insert Scene from the main menu. Immediately, the Flash environment looks like youve opened a new file. The timeline has only one, empty layer, and the stage is empty. In addition, you'll see a new scene name listed above the stage. The first new scene is called Scene 2 by default.

You can rename and reorder scenes using the Scene panel, Window Other Panels Scene. To rename a scene, double-click its name in the Scene panel and type the new name. To reorder scenes, drag-and-drop them into position in the Scene panel. Flash plays through scenes in the order listed in this panel, from top to bottom. You can also duplicate and delete scenes using the Scene panel.

Although scenes make it easy to isolate segments of a movie to author one section at a time, they are overkill when all you want to do is mark logical segments of your movie. You might mark logical segments in your movie to make the timeline easier to read during authoring, or you might want to mark frames so that you can point to them using ActionScript. In these cases, you can use frame comments and frame labels. Frame comments and labels appear as text strings in keyframes of the timeline.

Frame labels are exported with the SWF, which means that they are available to ActionScript and contribute (minimally) to file size. Frame comments, in contrast, are stripped out of the exported SWF, which means that they are useful only during authoring time and do not contribute to the SWF's file size. Frame labels are particularly useful when skipping the playhead to different sections of the timeline, as discussed in Recipe 10.4.

To add a frame label:

  1. Select a keyframe in the timeline.

  2. In the Property inspector's Frame Label field, type a name for the frame. Frame labels must contain only letters, underscores, and numbers, and should begin with a letter or underscore.

  3. To make sure the label applies, press Tab or Enter, or click anywhere else to deselect the field and apply the label.

To insert a frame comment, rather than label, follow the preceding steps, then select Comment from the Label type menu in the Property inspector.

Another way to segment portions of a movie is to encapsulate them in movie clip symbols. This approach offers considerable flexibility, especially with regard to ActionScript. Movie clips enable any combination of linear and nonlinear/interactive playback.

Finally, yet another approach to segmenting movies is to store them as separate .swf files, and load them into a parent or shell .swf file when the user needs them. This approach (discussed in Chapter 21) has many benefits, including optimizing download management, improved authoring workflow and maintenance, and high potential for interactivity.

See Also

Recipe 10.4, Recipe 10.7, Recipe 3.17




Flash 8 Cookbook
Flash 8 Cookbook (Cookbooks (OReilly))
ISBN: 0596102402
EAN: 2147483647
Year: 2007
Pages: 336
Authors: Joey Lott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net