如果使用VideoDisplay,那么他有一個(gè)屬性,叫cuePoints,值類(lèi)型為數(shù)組,數(shù)組中的每個(gè)元素要求有兩個(gè)屬性,一個(gè)是name,類(lèi)型為字符串,一個(gè)是time,類(lèi)型為數(shù)字,表示觸發(fā)時(shí)間的秒數(shù)。例如下面的代碼,當(dāng)播放到3s時(shí)將彈出一個(gè)對(duì)話框。這用來(lái)解決一些播放到某一時(shí)間點(diǎn)觸發(fā)某事件的情況。
<?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>