Flash CS4 ActionScript 3.0 Tutorial


How to Add Video Clips to Your Flash Project



Delivering video on the Flash platform is very effective. There are two basic methods for adding video to your fla file. The first method adds the video to the timeline and the movie becomes embedded into the final swf file.

The second establishes a link to an external fla or f4v file. Because the file is linked, it is necessary to include the external file when uploading your swf file to the server.

In this example we will display a QuickTime file using the link method. Note that the QuickTime file must first be converted to a flv file before you can import it to the timeline. This technique utilizes the FLVPlayback Component.

For more information on Flash video, see topics, Converting a Movie to a flv File, Importing a flv File (Linked) and Import Video to Flash Timeline.

Tutorial Elements

A flv file in a separate folder named Video


Step One

Open a new Flash document and name the default layer Video.

Step Two

Save your .fla file in a folder called Project. Name the file Main.fla.

Step Three

Add a new folder in the Project folder called Video.

Step Four

Add a flv file named Movie01.flv to the Video folder. For instructions on creating a flv file, see topic, Converting a Movie to a flv File.

Step Five

Return to the fla file and select frame one of the Video layer, then open the Components panel (Window > Components).

Step Six

Open the Video folder in the Components panel and double-click the FLVPlayback Component to add it to the center of the stage.

Step Seven

With the FLVPlayback Component selected, open the Component Inspector panel (Window > Component Inspector).

Step Eight

Click the value in the Skin row, then click the icon to select a new skin.

Step Nine

Click the color swatch in the skinBackgroundColor row, then select a new color for your skin.

Step Ten

Change the value in the Source row to Video/Movie01.flv. This is the path to your external flv file. You could also click the Browse icon and find your file.

Step Eleven

Test your movie by pressing Cmd/Return (PC - Ctrl/Enter). The movie appears and plays in your swf file. Notice that the movie is timeline independent. The main timeline has only one frame, yet the movie plays to the end.

Pay Attention to Frame Rate

Your imported flv file should be set to the same frame rate as your final swf file.