Flash CS3 Documentation |
|||
| Using ActionScript 3.0 Components > Using the FLVPlayback Captioning Component > Customizing the FLVPlaybackCaptioning component | |||
To start using the FLVPlaybackCaptioning component quickly, you can choose to use the FLVPlaybackCaptioning defaults which place the captioning directly over the FLVPlayback component. You may want to customize the FLVPlaybackCaptioning component to move the captioning away from the video.
The following code demonstrates how to dynamically create an FLVPlayback object with the toggle captioning button.
testVideoPath:String variable to an FLV file (using an absolute or relative path). |
NOTE |
|
The code example sets the |
testCaptioningPath:String variable to an appropriate Timed Text XML file (using an absolute or relative path). |
NOTE |
|
The code example sets the |
package{import flash.display.Sprite;import flash.text.TextField;import fl.video.FLVPlayback;import fl.video.FLVPlaybackCaptioning;public class FLVPlaybackCaptioningExample extends Sprite {private var testVideoPath:String = "http://www.helpexamples.com/flash/video/caption_video.flv";private var testCaptioningPath:String = "http://www.helpexamples.com/flash/video/caption_video.xml";public function FLVPlaybackCaptioningExample() {player.source = testVideoPath;player.skin = "SkinOverAllNoCaption.swf";player.skinBackgroundColor = 0x666666;player.skinBackgroundAlpha = 0.5;captioning.flvPlayback = player;captioning.source = testCaptioningPath;captioning.autoLayout = false;captioning.addEventListener("captionChange",onCaptionChange);}private function onCaptionChange(e:*):void {var tf:* = e.target.captionTarget;var player:FLVPlayback = e.target.flvPlayback;// move the caption below the videotf.y = 210;}}}
For more information on all of the FLVPlaybackCaptioning parameters, see the ActionScript 3.0 Language and Components Reference.
Flash CS3