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 咖啡屋的鼠標 閱讀(1103) 評論(0)  編輯  收藏 所屬分類: Flex

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

          導航

          統計

          常用鏈接

          留言簿(15)

          隨筆分類(52)

          隨筆檔案(76)

          文章分類(3)

          文章檔案(4)

          新聞檔案(1)

          收藏夾

          Flex

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 嵊州市| 陵川县| 虹口区| 松溪县| 永定县| 佛教| 新蔡县| 米易县| 铜鼓县| 太保市| 浦江县| 三台县| 凤翔县| 桦甸市| 石狮市| 建阳市| 延吉市| 文成县| 宁武县| 游戏| 剑阁县| 射阳县| 嘉义县| 株洲市| 静乐县| 黎平县| 南昌县| 庆城县| 巩义市| 星座| 永吉县| 大新县| 禄丰县| 晋中市| 巢湖市| 会理县| 惠东县| 盈江县| 雷波县| 鲁甸县| 兴海县|