Adding captioning to the FLVPlayback component

You can add the FLVPlaybackCaptioning component to any FLVPlayback component. For information on adding FLVPlayback components to your application, see Creating an application with the FLVPlayback component.

To add the FLVPlaybackCaptioning component from the Components panel:

  1. In the Components panel, open the Video folder.
  2. Drag (or double-click) the FLVPlaybackCaptioning component and add it to the same stage as the FLVPlayback component to which you want to add captioning.

    NOTE

    Adobe provides two samples to help you learn the FLVPlaybackCaptioning component quickly: caption_video.flv (a FLVPlayback sample) and caption_video.xml (a captioning sample). Access these files at http://www.helpexamples.com/flash/video.

  3. (Optional) Drag the CaptionButton component to the same stage as the FLVPlayback and FLVPlaybackCaptioning components. The CaptionButton component enables a user to turn captioning on and off.

    NOTE

    To enable the CaptionButton component, you must drag it to the same stage as the FLVPlayback and FLVPlaybackCaptioning components.

  4. With the FLVPlaybackCaptioning component selected on the Stage, on the Parameters tab of the Property inspector, specify the following required information:
    • Set showCaptions to true.
    • Specify the source of the Timed Text XML file to download.

    TIP

    While working in Flash to test your captions, you should set the showCaptions property to true. However, if you include the CaptionButton component to allow users to turn captioning on and off, you should set the showCaptions property to false.

    Other parameters are available to help you customize the FLVPlaybackCaptioning component. For more information, see Customizing the FLVPlaybackCaptioning component and the ActionScript 3.0 Language and Components Reference.

  5. Select Control > Test Movie to start the video.

To create an instance dynamically using ActionScript:

  1. Drag the FLVPlayback component from the Component panel to the Library panel (Windows > Library).
  2. Drag the FLVPlaybackCaptioning component from the Component panel to the Library panel.
  3. Add the following code to the Actions panel on Frame 1 of the Timeline.

    NOTE

    The following example is for Adobe Flash CS3 for Windows. The location of FLVPlayback Skins on the Macintosh is Macintosh HD/Applications/Adobe Flash CS3/ Configuration/FLVPlayback Skins/ActionScript 3.0/SkinUnderPlaySeekCaption.swf.

    import fl.video.*; var my_FLVPlybk = new FLVPlayback(); my_FLVPlybk.x = 100; my_FLVPlybk.y = 100; addChild(my_FLVPlybk); my_FLVPlybk.skin = "install_drive:/Program Files/Adobe/Adobe Flash CS3/en/Configuration/FLVPlayback Skins/ActionScript 3.0/SkinUnderPlaySeekCaption.swf"; my_FLVPlybk.source = "http://www.helpexamples.com/flash/video/caption_video.flv"; var my_FLVPlybkcap = new FLVPlaybackCaptioning(); addChild (my_FLVPlybkcap); my_FLVPlybkcap.source = "http://www.helpexamples.com/flash/video/caption_video.xml"; my_FLVPlybkcap.showCaptions = true;
  4. Change install_drive to the drive on which you installed Flash, and modify the path to reflect the location of the Skins folder for your installation:

    NOTE

    If you create an FLVPlayback instance with ActionScript, you must also assign a skin to it dynamically by setting the skin property with ActionScript. When you apply a skin with ActionScript, it is not automatically published with the SWF file. Copy the skin SWF file and the application SWF file to your server, or the skin SWF file won't be available when a user executes it.