在线运行效果请访问:http://tongqiuyan.blog.163.com/blog/static/19554530220119164211339/
该实例的源码如下:
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" horizontalAlign="center" verticalAlign="top" fontSize="12">
- <mx:Script>
- <![CDATA[
- import mx.messaging.MultiTopicConsumer;
- private function getTime():void
- {
- var pDate:Date = new Date(myPlayer.playheadTime * 1000 || 10);
- var tDate:Date = new Date(myPlayer.totalTime*1000);
- progressBar.label = dateFormater.format(pDate) + " / " + dateFormater.format(tDate);
- }
- ]]>
- </mx:Script>
- <mx:DateFormatter id="dateFormater" formatString="NN:SS" />
- <mx:Panel width="520" height="400" title="Flex播放器">
- <mx:VideoDisplay id="myPlayer" autoPlay="false" width="100%" height="100%" playheadUpdate="getTime();"
- source="http://d298.v.iask.com/f/1/d75c35113920fe8d63d32ead7bc2f18a62729452.hlv" />
- <mx:HBox paddingBottom="5" paddingLeft="5" width="100%" verticalAlign="middle">
- <mx:Image source="http://dl.iteye.com/upload/picture/pic/100759/e0234a4c-a7c1-3b6b-aa96-763f55c89b4e.png" click="myPlayer.play();" width="25" height="25" />
- <mx:Image source="http://dl.iteye.com/upload/picture/pic/100757/53003055-7e70-35b8-b91b-28b06b8ae9d0.png" click="myPlayer.pause();" width="25" height="25" />
- <mx:Image source="http://dl.iteye.com/upload/picture/pic/100761/e0278852-830d-36ee-9260-a91906cd3902.png" click="myPlayer.stop();" width="25" height="25" />
- <mx:ProgressBar id="progressBar" source="myPlayer" labelPlacement="center" width="300" />
- <mx:Label text="Vol" />
- <mx:HSlider id="volSlider" width="50" minimum="0" value="0.8" maximum="1" snapInterval="0.1" />
- </mx:HBox>
- </mx:Panel>
- </mx:Application>
涉及到控件主要是VideoDisplay、Image、ProgressBar、HSlider等。
转载于:https://blog.51cto.com/tongqiuyan/689350