O'Reilly logo

Flash 8 Cookbook by Joey Lott

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

18.3. Playing Flash Video

Problem

You want to play streaming or progressive-download Flash Video content.

Solution

Code your own playback interface or use the FLVPlayback component.

Discussion

You can display Flash Video in your Flash projects by building your own interface and writing ActionScript to load the video. The general process to building a simple Flash Video player involves these steps:

  1. Add a Video object to the library of your Flash document, and place an instance of that Video object on the stage.

  2. In the Actions panel, create NetConnection and NetStream objects. If your Flash Video resides on a web server, specify the URL to the .flv file in the NetStream.play( ) method. If your Flash Video resides on a Flash Communication Server, Flash Media Server, or Flash Video Streaming Service (FVSS) provider account, specify the RTMP location of the application in the NetConnection.connect( ) method and the FLV (without the .flv extension) in the NetStream.play( ) method.

  3. Add Button or MovieClip instances to act as play, stop, or pause buttons that control the playback of the video file.

To build a simple playback for progressive-download FLV files, follow these steps:

  1. Create a new Flash document in Flash 8.

  2. In the Library panel, click the Options menu in the top right corner and choose New Video. In the Video Properties dialog box, set the Type option to Video (ActionScript-controlled). Name the symbol whatever you prefer, and click OK.

  3. Rename layer 1 to Video. On frame 1 of this layer, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required