多次击球,引起回音,我无法阻止我的MP3播放器。 mp3播放的最佳做法是什么?
var mySound:Sound = new Sound();
playButton.addEventListener (MouseEvent.CLICK, myPlayButtonHandler);
var myChannel:SoundChannel = new SoundChannel();
function myPlayButtonHandler (e:MouseEvent):void {
myChannel = mySound.play();
}
stopButton.addEventListener(MouseEvent.CLICK, onClickStop);
function onClickStop(e:MouseEvent):void{
myChannel.stop();
}
答案 0 :(得分:1)
以下是两个全局控制音量的按钮。如果这不起作用,请告诉我。
var mySound:Sound = new Sound();
playButton.addEventListener (MouseEvent.CLICK, myPlayButtonHandler);
var myChannel:SoundChannel = new SoundChannel();
function myPlayButtonHandler (e:MouseEvent):void {
myChannel = mySound.play();
}
stopButton.addEventListener(MouseEvent.CLICK, onClickStop);
function onClickStop(e:MouseEvent):void{
myChannel.stop();
}
/*-----------------------------------------------------------------*/
//global sound buttons, add instance of 'killswitch' and 'onswitch' to stage
killswitch.addEventListener(MouseEvent.CLICK, clipKillSwitch);
function clipKillSwitch(e:MouseEvent):void{
var transform1:SoundTransform=new SoundTransform();
transform1.volume=0;
flash.media.SoundMixer.soundTransform=transform1;
}
onswitch.addEventListener(MouseEvent.CLICK, clipOnSwitch);
function clipOnSwitch(e:MouseEvent):void{
var transform1_:SoundTransform=new SoundTransform();
transform1_.volume=1;
flash.media.SoundMixer.soundTransform=transform1_;
}
答案 1 :(得分:0)
我会做几件事。
另一种选择: 2.将播放按钮更改为暂停按钮。然后,如果按下按钮,则执行停止操作。如果他们然后点击暂停,则将按钮切换回来播放。