1 <?xml version="1.0" encoding="utf-8"?>
2 <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" verticalGap="0">
3 <mx:ViewStack id="videoStack" width="100%" height="100%">
4 <mx:Box id="previewContainer">
5 <mx:Image id="preview" width="100%" height="100%" source="{previewImage}"
8 <mx:Box id="videoContainer">
9 <mx:VideoDisplay id="video"
10 metadataReceived="prepareVideo()"
11 playheadUpdate="advanceProgress(event)"
14 width="100%" height="100%" />
17 <mx:HBox backgroundColor="#6495ED" width="100%" height="16">
18 <mx:Image id="playButton" width="16" height="16" source="{playImage}" click="playVideo()" />
19 <mx:HSlider width="100%" id="progressBar" liveDragging="true"
20 allowTrackClick="false"
21 thumbPress="progressThumbPress(event);"
22 thumbRelease="progressThumbRelease(event);" />
28 /** VideoPlayer component for P2 help dialog.
31 <help:VideoPlayer width="400" height="300"
32 file="videos/test.flv"
33 previewImage="videos/test_preview.png" />
35 previewImage is the image that will be shown in the video pane
36 before the user clicks 'play' - usually a still of the first frame
37 of the video. (This means the video file won't be downloaded unless
38 the user actually wants it.)
41 [Bindable] public var file:String;
42 [Bindable] public var previewImage:String;
43 private var wasPlaying:Boolean;
45 [Bindable] [Embed(source="../../../../embedded/video_play.png" )] public var playImage:Class;
46 [Bindable] [Embed(source="../../../../embedded/video_pause.png")] public var pauseImage:Class;
48 public function playVideo():void {
49 if (videoStack.selectedChild==previewContainer) {
53 playButton.source=pauseImage;
54 } else if (video.playing) {
56 playButton.source=playImage;
59 playButton.source=pauseImage;
62 public function prepareVideo():void {
63 videoStack.selectedChild=videoContainer;
64 progressBar.maximum=video.totalTime;
66 public function progressThumbPress(event:Event):void {
67 wasPlaying=video.playing;
69 playButton.source=playImage;
71 public function progressThumbRelease(event:Event):void {
72 video.playheadTime = event.currentTarget.value;
73 if (wasPlaying) playVideo();
75 public function advanceProgress(event:VideoEvent):void {
76 progressBar.value = event.playheadTime;
78 public function stopPlaying():void {
79 if (!video.playing) return;
81 playButton.source=playImage;