Basics of video

Introduction to working with video

One important capability of Adobe Flash Player is the ability to display and manipulate video information with ActionScript in the same way that you can manipulate other visual content such as images, animation, text, and so on.

When you create a Flash Video (FLV) file in Adobe Flash CS3 Professional, you have the option to select a skin for your video including common playback controls. However, there is no reason you need to limit yourself to the options available. Using ActionScript, you have fine-tuned control over loading, displaying, and controlling playback of video--meaning you could create your own video player skin, or use your video in any less traditional way that you want.

Working with video in ActionScript involves working with a combination of several classes:

When you're loading external video, you can load the file from a standard web server for progressive download playback, or you can work with streaming video delivered by a specialized server such as Adobe's Macromedia® Flash® Media Server.

Common video tasks

This chapter describes the following video-related tasks that you will likely want to perform:

Important concepts and terms

Working through in-chapter examples

As you're working through the chapter, you may want to test some of the example code listings for yourself. Because this chapter is about working with video in ActionScript, many of the code listings in this chapter involve working with a video object, which could be one that has been created and placed on the Stage in Flash authoring, or one that's created using ActionScript. Testing a sample will involve viewing the result in Flash Player to see the effects of the code on the video.

Most of the example code listings manipulate a Video object without creating the object explicitly. To test these code listings in this chapter:

  1. Create an empty Flash document.
  2. Select a keyframe in the Timeline.
  3. Open the Actions panel and copy the code listing into the Script pane.
  4. If necessary, open the Library panel.
  5. From the Library panel menu, choose New Video.
  6. In the Video Properties dialog box, enter a name for the new video symbol, and choose Video (ActionScript-controlled) in the Type field. Click OK to create the Video symbol.
  7. Drag an instance of your video symbol from the Library panel onto the Stage.
  8. With the video instance selected, in the Property inspector, give it an instance name. The name should match the name used for the Video instance in the example code listing--for example, if the code listing manipulates a Video object named vid, you should name your Stage instance vid as well.
  9. Run the program using Control > Test Movie.

    On the screen you will see the results of the code manipulating the video as specified in the code listing.

Some example code listings in this chapter include a class definition in addition to the example code. In those listings, in addition to the previous steps, and before testing the SWF, you will need to create the class that's used in the example. To create a class defined in an example code listing:

  1. Make sure you have saved the FLA file that will be used for testing.
  2. From the main menu choose File > New.
  3. In the New Document dialog, in the Type section, choose ActionScript File. Click OK to create the new ActionScript file.
  4. Copy the class definition code from the example into the ActionScript document.
  5. From the main menu, choose File > Save. Save the file in the same directory as the Flash document. The file's name should match the name of the class in the code listing. For instance, if the code listing defines a class named "VideoTest," save the ActionScript file as "VideoTest.as".
  6. Return to the Flash document.
  7. Run the program using Control > Test Movie.

    You will see the results of the example displayed on the screen.

Other techniques for testing example code listings are explained in more detail in Testing in-chapter example code listings.


Flash CS3

Take a survey


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00000252.html