16 January 2006
This article is geared towards beginning Flash users and developers who are interested in using a simple video navigation template. While programming experience is not necessary to understand the tutorial, you may find it beneficial to review the Flash Video Learning Guide.
Beginning
This video presentation Flash template is great for basic video presentations, such as when you want the user to see the main topics of a video and be able to navigate quickly to them. It does not contain some of the more sophisticated features such as synchronizing content on the screen with the video playback, as described in my other tutorial, Flash Video Template: Spokesperson Presentation with Synchronized Graphics. However, you should have little trouble modifying it to work well for your own needs.
This is the second version of the template updated to work with the new Flash Professional 8 FLVPlayback component and the FLVPlayback behaviors that I designed. The updated template is built on a standard Flash timeline and has been simplified for easier editing and customization. The template features a video and navigation buttons, which allow the user to jump to topics within the video.
Consider applying the following special touches to bring this presentation to life in your company:
You can easily change this template to fit your needs.
This article describes how to modify all the basic characteristics so your project looks as you want. For example, you will certainly want to add your own video to this presentation. After that, you can update the button text along the left side of the presentation. Finally, you can change the color schemes and logos to match your own.
Note: If you are still using Flash MX Professional 2004 and not Flash Professional 8, please see the previous version of this article.
In this version of the template, the content is distributed on layers on the main Timeline. This simplifies things and provides for easy access to all the editable features in a single location. Take a quick look at the main Timeline of the template shown in Figure 1.
The first thing to notice is that the main Timeline is divided into sections, at least conceptually, by the two layer folders. The Controls folder contains the video controls, video background graphic, and navigation buttons. You will edit these items to change the video and look and feel of the controls. The Background graphics folder contains the logos and background graphics, which make up the general look and feel of the template. You will edit these items to add your own logo and company branding. The Actions layer contains a few lines of ActionScript code, which you don't necessarily need to edit.
In addition to clearly laying out the pieces of the template, the layer folders enable you to lock or hide easily the sections of the template that you are not currently working on.
While you're browsing through the file, open the Library panel (Window > Library) and take a look at its contents (see Figure 2).
The first thing to notice is that there are only two custom-built symbols in the Library. The first is the CueNameButton movie clip in the Controls folder. This is used for the navigation buttons, which sit to the left of the video display. The second is the VideoFrame movie clip, which creates the background for the video display. All of the other symbols are gathered from the Flash Professional 8 Components panel in the new FLV Playback categories.
Note: The FLV Playback Skins folder contains customizable skin graphics for each of the video controls.
The last stop on the project overview is the Components panel. One of the major upgrades in Flash Professional 8 is the improved video features. The Components panel has been expanded to contain two new categories: FLV Playback – Player 8 and FLV Playback Custom UI (see Figure 3).
Open the Components panel (Window > Components) and take a look at the two new video categories. The Flash team put a lot of effort into making the new FLVPlayback components easy to edit and customize. All of the controls in the template come from the Components panel except for the navigation button, which I designed to complement this set.
When comparing the Components panel to the Library, note that the template does not use every video control available. You will be able to add and remove controls as desired.
The FLVPlayback component displays the video in the template (see Figure 4). You will select the FLVPlayback instance to change the layout and parameters of the video. You can change the following items to customize the display:
The video component in Figure 4 appears as a black rectangle with the Flash video icon in the center. When you select it, it appears with a blue bounding box surrounding the instance. The parameters for the video component can be set in the Property Inspector panel or in the Component Inspector panel. Also notice that the custom video controls (play, stop, seek bar, volume bar, and mute button) are separate controls, which are not attached to the FLVPlayback instance (you will explore changes to these controls in the section "Modifying the Buttons and Video Controls").
To change the video and FLVPlayback parameters:
contentPath field to select it and then click it again to launch the Content Path dialog box (see Figure 5).
totalTime parameter is set to 328 to mark the length of the video in seconds. The video used in this sample is an older FLV file, where the totalTime value is not embedded in the FLV file's metadata. Entering the length manually enables the seek bar control to work properly.If you are using a newer FLV file, then you can remove this setting. Feel free to change it to match the correct length of your video in seconds. If you're streaming the FLV file from Flash Media Server, you will want to turn the isLive parameter to true and adjust the bufferTime parameter to match an appropriate buffer time for your target bandwidth. In this template the skin and skinAutoHide parameters are not being used.
For more information on FLVPlayback component parameters, refer to the Flash 8 LiveDocs (Components Language Reference > FLVPlayback Component (Flash Professional Only) > Using the FLVPlayback Component > FLVPlayback Component Parameters).
Note that the FLVPlayback component uses embedded metadata in the FLV file to determine the size and duration of the video for automated features such as "Match source FLV dimensions." If you are trying to use an older FLV file that does not contain this metadata, you may notice that some of these features may not work. If this is the case, your best bet is to encode the original video to the FLV format again using the Flash 8 Video Encoder or use a utility to embed the metadata in the older FLV file.
To change the layout of the video component, you can either let the component automatically size itself to the target FLV file or you can manually size the component on the Stage.
If you want the component to size itself automatically, follow the steps in the previous section for assigning the contentPath parameter and make sure you select the Match Source FLV Dimensions check box. Doing so will size the video component appropriately on the Stage so that you can position it visually as desired.
To size the video instance manually, follow these steps:
autoSize and maintainAspectRatio fields to false in the parameter list. These parameters affect the component when the SWF file is playing. Turning off the parameters enables the video to be displayed at any size you choose.maintainAspectRatio parameter to adjust how the video appears in the custom size view.To move the video to a new location, follow these steps:
The navigation buttons appearing along the left side of the video display are a key feature of the template. These buttons enable users to jump to predefined sections (topics) within the video. The navigation buttons label each section of the video and enable users to understand the content of the movie and how to seek to any topic desired. In this next section of the article, you'll learn how to do the following:
Before you jump into editing the navigation buttons, it's important to understand what is happening with the video component that makes this all work. The big picture is that you can assign sections in each FLV file that can be used for navigation and synchronization. These sections are called cue points. You can add them to the video when it is initially encoded to the FLV format, by using the cuePoints field in the FLVPlayback parameters, or by using ActionScript while the SWF file plays. For this demonstration, I will explore adding and removing cue points using the Flash Video Cue Points dialog box (see Figure 6).
As you can see, named cue points can be added to each video to create sections within the video. Cue points have an associated time within the video and may also contain other data that can be referenced as cue points are encountered along the video Timeline.
To change, add, or remove cue points, follow these steps:
cuePoints parameter once to select it and then click it again to launch the Flash Video Cue Points dialog box.That's it. After you add your own video to the FLVPlayback component, you will adjust the cue points to match the sections of your video. You can use as many or as few cue points as you want. From there, you will update the navigation buttons to match the cue point entries.
Note: Embedding navigation cue points during encoding is more accurate than using the Flash Video Cue Points dialog box. If you are having problems with the accuracy of seeking to exact cue point times, consider encoding the video and cue points together using the Flash 8 Video Encoder instead.
As you view the template in action, you'll notice that the down state for each button appears when the video plays past the related cue point. This template uses a naming convention to find the navigation button when a cuePoint event fires from the video component. The Actions layer contains an event handler function which processes cuePoint events.
When an event occurs, the function looks for a button whose instance name matches the cue point name plus the letters "_btn". If a button exists, it triggers the button to show its down state. For example, if a cue point event named introduction passes through the event handler function, then the button whose instance name is introduction_btn is highlighted with its down state. There's no need to adjust any of the code. Simply create cue points and name the corresponding buttons with the cue point name plus "_btn".
While reviewing the layers in the template, you may have noticed that two layers are set aside for the navigation buttons. The Button Text layer contains the text for each navigation button. The text is simply static text positioned and typeset in any way desired. The Button Symbols layer contains instances of the CueNameButton symbol used to create the button graphics below the text.
To change the text on a navigation button:
The CueNameButton symbol uses the new Flash 8 scaling feature called Scale 9. This enables the button to be scaled from instance to instance without seeing the effects of distortion common to most scaled movie clips. The template provides a simple button skin with an up, over, and down state that you can customize to fit your needs. You will edit your graphics in the Library and use the scale guides to control how Flash renders your graphics at different sizes (see Figure 8).
To edit the up, over, and down button skins, follow these steps:
You can move and resize the navigation buttons any way you like. If you resize the buttons make sure that you export the SWF file to view the effects of the Scale 9 feature on your button graphics (it can be seen only in the SWF file).
To remove a navigation button, simply select the button instance and the text on top of it and delete the two items from the Stage.
You have two options when adding a navigation button to your file. You can either drag a new instance of the CueNameButton symbol from the Library to the Stage or copy an existing button.
To add a new navigation button and associated cue point, follow these steps:
To trigger a cue point change from a new button:
That's it. Your new navigation button should trigger the video to jump to the corresponding cue point.
Note: The FLVPlayback behaviors need to be installed by running the FLVPlaybackBehav.mxp file. After you install the behaviors, they should appear in the Behaviors panel shown in Figure 10.
The template contains a basic set of video controls, including a play/pause button, stop button, seek bar, volume bar, and mute button. These controls are placed on the FLV Controls layer alongside the FLVPlayback instance. The controls are associated with the FLVPlayback instance using a small amount of ActionScript code on the Actions layer. You can remove any or all of the controls without making other adjustments to the template. If you want to add additional custom user interface components, you will need to name their instances and update the code on the Actions layer to associate them with the video component.
To remove all the user interface controls, follow these steps:
//-----------------
// Video control assignment
//-----------------
// Use the skin assignment properties of the FLVPlayback
// instance to associate the controls with the player.
display.playPauseButton = play_btn;
display.stopButton = stop_btn;
display.seekBar = seek_bar;
display.volumeBar = volume_bar;
display.muteButton = mute_btn;
You may add any combination of FLVPlayback custom user interface controls by dragging instances from the Components panel to the Stage. You must name the instance and assign the instance name to the FLVPlayback instance using assignment properties as seen in the code above.
To add a buffering bar, you would follow these steps:
// Assign the buffering bar to the video component
display.bufferingBar = bufferingBar_mc;
The FLVPlayback component has a handful of control assignment properties that you can use in a similar way as above to assign the other control types to the video component. The property list includes the following:
playButtonpauseButtonplayPauseButtonstopButtonmuteButtonbackButtonforwardButtonvolumeBarseekBarbufferingBarYou can customize the FLVPlayback custom controls easily to match whatever look and feel you need. For this template I changed the green highlight color to a red to match the video theme better. See my article, Customizing the FLVPlayback Component, for more information on skinning options.
One of the easiest changes to make to the template is modifications to the look and feel of the background graphics. Changing the color of the chrome (gradient) graphics in the background can really go a long way in creating a unique-looking template that fits your company's branding and tone. Simple changes to the template may include:
As you've seen in previous sections of this article, the playback component and the video controls are separate. This makes customizations easy by enabling you to move the controls to any location, swap different types of controls in and out of the template, and create any background graphic you like. For the purposes of this template, I created a simple custom background inside the VideoFrame symbol in the Library (see Figure 12).
To edit the video background graphic, follow these steps:
This is the easy part. Edit the layers contained in the Background Graphics Layer folder (see Figure 13). You can add and remove layers and graphics as needed.
To change the background and logos, follow these steps:
Now that you have made the presentation your own, there are many ways to craft it to target your needs more specifically:
Spend some time with the tutorial Flash Video Template: Showcase Website for Personal Video for even more ideas on fun, effective ways to communicate your message better. Make sure you also explore the other Flash video templates provided in the Flash Developer Center.
Flash User Forum |
More |
| 04/23/2012 | Auto-Save and Auto-Recovery |
|---|---|
| 04/23/2012 | Open hyperlinks in new window/tab/pop-up ? |
| 04/21/2012 | PNG transparencies glitched |
| 04/01/2010 | Workaround for JSFL shape selection bug? |
Flash Cookbooks |
More |
| 02/13/2012 | Randomize an array |
|---|---|
| 02/11/2012 | How to create a Facebook fan page with Flash |
| 02/08/2012 | Digital Clock |
| 01/18/2012 | Recording webcam video & audio in a flv file on local drive |