Unlike earlier versions, Flash MX lets you import digital video into a Flash movie, which can then be played in Flash Player 6 or higher. Prior to MX, QuickTime movies could be linked to a movie in Flash, but then the exported files required a QuickTime Player to view, and the video was still external to the Flash movie. While you can still link to QuickTime Flash movies in MX, you can also embed these and other types of video within Flash. The videos are stored in the document’s library as Flash Video files (.flv).
Keep in mind that if you link to a QuickTime video, rather than embedding it, you’ll have to publish your SWF file as a QuickTime video. The linked video remains external to Flash. As an embedded video, the user only needs the Flash player to view the movie.
To add a video to your movie:
From the File menu, select Import and then Import to Stage or Import to Library.
In the Import dialog, navigate to the video file and click Open.
This opens the Video Import Wizard:
Note:
If you selected a QuickTime format, the first screen of the wizard asks you whether you want to link to or embed the video:
Make a selection and click Next. This leads to the screen shown previously, where you’re asked if you want to edit the video first.
To see the editing options, select Edit the video first and click Next.
This is a relatively simple screen that lets you divide the video into discrete clips. Clips let you define multiple in and out points for the video.
When you’re ready, click Next.
You can select from pre-defined compression profiles, based on the anticipated bandwidth of your users, or you can edit one of these settings by clicking the Edit button, or create a new profile by selecting Create new profile from the Compression profile drop-down menu:
The compression screen is simpler in MX 2004 than it was in MX. The Bandwidth and Quality sliders are related, so as you adjust one, the other is adjusted automatically:
The Keyframes slider sets the keyframe interval for the video—the number of keyframes Flash inserts. Oddly, the lower the value, the more keyframes Flash inserts, although entering 0 inserts no keyframes. The more keyframes Flash inserts, the higher the file size will ultimately be. Experiment with this setting, as more keyframes doesn’t necessarily result in better quality.
For any video being used in your finished movie, select High quality keyframes. For placeholder video that won’t ultimately be used, select Quick compress to speed the compression.
Check Synchronize to Macromedia Flash document frame rate to change the video’s frame rate to match the frame rate of the Flash document. Keep in mind that if the video has a higher frame per second (fps) rate than the Flash document, Flash will cut the extra frames from each second of the video. When this check box is cleared, Flash assigns each frame of the video to a frame in the Flash document. The corresponding menu below this check box control the ration of video frames to Flash frames. A 1:1 ratio preserves the original frame rate of the video.
Use the preview window to preview the effects of your settings on the video.
When you’ve finished, click Next.
Save your new settings by entering a new name for the settings and clicking Next.
After you’ve saved your new compression settings, you’re returned to the Encoding screen, where you can also take advantage of some advanced settings. Under Advanced settings, select Create new profile:
In the Advanced Settings screen, adjust the color and dimensions of the video:
Under Track options, you can choose to import the video to the current Timeline (though default, the option isn’t applied when importing to the library) or to insert the video into a movie clip or graphic symbol. The audio track can be integrated into the video (the default option), imported separately, or not imported at all.
When you’ve finished, click Next.
In the next screen, save your advanced settings by entering a name for them and clicking Next.
Confirm your selections in the Encoding screen.
Click Finish to import the video.
The video now appears in the library:
If you imported the video clip to the Stage rather than the library, a warning notifies you if the imported clip contains more frames than the current Timeline. Click Yes to insert the required number of frames or No to maintain the current Timeline. If you select No, the video frames appearing outside the current Timeline aren’t displayed in the movie.
The video can be added to the Stage from the library by dragging it like any other object. A warning appears if the video exceeds the current number of frames in the Timeline.
You can treat a video object like any other—you can scale it, skew it, rotate it, and even give it an instance name to refer to it:
Using Flash’s Video behaviors, you can add playback buttons, as well, though in order to do this, you must attach the behavior to a movie clip, and not a button. The simplest way to get around this problem is to drag an instance of a button symbol on the Stage and then, in the Property Inspector, change the instance from Button to Movie Clip.
To add Video behaviors to buttons:
Create a buttons layer on the Stage and, with the first frame of the layer selected, drag your buttons onto the Stage:
If necessary, change each button to a movie clip using the drop-down menu in the Property Inspector:
Make sure you’ve given the video an instance name in the Property Inspector:
To prevent the video from playing automatically when the movie loads, use the same procedure you did for the sound object: on the first frame of the Actions layer, click the Add Behavior button in the Behaviors panel and select Embedded Video and then Stop.
To add a play behavior to the play button, select the button. Then, in the Behaviors panel, click the Add Behavior button and select Embedded Video and then Play.
In the Play dialog, select the instance of the video to play and click OK.
Repeat these steps to add behaviors to the remainder of your buttons, just as you did in earlier sections to control sound and movie clip playback. You can add behaviors to stop, pause, rewind, and fast forward, among others.
Tip:
If you don’t see all the options in the menu, it’s probably because you’re selecting a button instance, rather than a movie clip instance. Don’t forget to change all your button instances to movie clips.