Flex中當視頻播放到某一時間點時觸發事件的樣例代碼

          如果使用VideoDisplay,那么他有一個屬性,叫cuePoints,值類型為數組,數組中的每個元素要求有兩個屬性,一個是name,類型為字符串,一個是time,類型為數字,表示觸發時間的秒數。例如下面的代碼,當播放到3s時將彈出一個對話框。這用來解決一些播放到某一時間點觸發某事件的情況。
          <?xml version="1.0" encoding="utf-8"?>
          <!-- LearnCurPointEvent.mxml -->
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init()">
              
          <mx:Script>
                  
          <![CDATA[
                      import mx.controls.Alert;
                      import mx.events.CuePointEvent;
                      [Bindable]
                      private var myCuePoints:Array = [
                      { name: "first", time: 3}]; 
                      
                      private function init():void{
                          this.c_mainVideoDisplay.cuePoints = myCuePoints;
                          this.c_mainVideoDisplay.addEventListener(CuePointEvent.CUE_POINT,cue_PointHandler);
                      }
                      
                      private function cue_PointHandler(event:CuePointEvent):void{
                          c_mainVideoDisplay.pause();
                          Alert.show("It plays " + event.cuePointTime +"s.","",4,null,go);
                      }
                      
                      private function go(event:Event):void{
                          c_mainVideoDisplay.play();
                      }
                  
          ]]>
              
          </mx:Script>
              
                      
          <mx:VideoDisplay id="c_mainVideoDisplay" width="320" height="240" 
                          cuePointManagerClass
          ="mx.controls.videoClasses.CuePointManager"
                          source
          ="phone.flv" 
                          autoPlay
          ="false" />
                      
          <mx:Button label="播放" click="go(event)"/>
          </mx:Application>


          posted on 2008-01-20 21:44 咖啡屋的鼠標 閱讀(1098) 評論(0)  編輯  收藏 所屬分類: Flex

          <2008年1月>
          303112345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          導航

          統計

          常用鏈接

          留言簿(15)

          隨筆分類(52)

          隨筆檔案(76)

          文章分類(3)

          文章檔案(4)

          新聞檔案(1)

          收藏夾

          Flex

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 晋城| 涿州市| 合作市| 波密县| 准格尔旗| 资溪县| 鄱阳县| 韶关市| 清远市| 龙岩市| 搜索| 仁寿县| 江山市| 诸暨市| 彩票| 祁门县| 丰台区| 高青县| 枣强县| 花垣县| 凤城市| 荆州市| 石渠县| 荔波县| 舟曲县| 报价| 乌拉特中旗| 阿图什市| 庆安县| 闸北区| 尚志市| 交口县| 沁水县| 中超| 湄潭县| 昌乐县| 绥棱县| 天祝| 元谋县| 宁阳县| 嘉义市|