1
守則連接旋律和創建實例的形式,一個簡單的自定義搜索條..如何創建在ActionScript音樂播放器3.0
import flash.events.Event;
var mySound:Sound = new MyFavSong();
var myChannel:SoundChannel = new SoundChannel();
var lastPosition:Number = 0;
var myTransform = new SoundTransform();
myChannel = mySound.play();
myTransform.volume = 1;
myChannel.soundTransform = myTransform;
stop();
然後播放按鈕,暫停,聲音停止+音量 停止
stop_btn.addEventListener(MouseEvent.CLICK, onClickStop);
function onClickStop(e:MouseEvent):void{
myChannel.stop();
lastPosition = 0;
stop();
}
暫停
pause_btn.addEventListener(MouseEvent.CLICK, onClickPause);
function onClickPause(e:MouseEvent):void{
lastPosition = myChannel.position;
myChannel.stop();
stop();
}
播放
play_btn.addEventListener(MouseEvent.CLICK, onClickPlay);
function onClickPlay(e:MouseEvent):void{
myChannel = mySound.play(lastPosition);
myChannel.soundTransform = myTransform;
play();
}
卷
up_btn.addEventListener(MouseEvent.CLICK, onClickUp);
function onClickUp(e:MouseEvent):void{
myChannel.soundTransform = myTransform;
myTransform.volume = myTransform.volume + 1;
}
請幫我
不要使用play()和stop()方法,因爲它們會影響你的主時間軸(或者你的函數聲明爲影片剪輯),而不是聲音。 – DigitalD