2011-08-22 54 views
1

我想在Flash中播放聲音,但只是完整聲音的間隔。例如,從10秒開始到15秒結束。Flash AS3定義聲音結束時間

我知道如何設置起點,但我不知道如何設置終點。 這是I'm使用的代碼:

var s:Sound = new Sound(new URLRequest("mp3/mysound.mp3")); 
var channel:SoundChannel = new SoundChannel(); 
channel = s.play(start_point); 

你能幫我傢伙?

最佳,弗拉維奧

回答

2

有沒有內置的聲音,你可以利用的,所以你必須設置一個計時器以及方法或屬性。

var s:Sound = new Sound(new URLRequest("mp3/mysound.mp3")); 
var channel:SoundChannel = new SoundChannel(); 
var timer:Timer = new Timer(5000, 1); 
timer.addEventListener(TimerEvent.TIMER_COMPLETE, stopSound); 
timer.start(); 
channel = s.play(start_point); 

function stopSound(e:TimerEvent):void { 
    channel.stop(); 
} 

編輯您的聲音文件以獲得您想要的聲音片段也可能同樣簡單。