Flash mp3播放停止回音,as3
多次点击play,会产生回声,我无法停止mp3播放器。 mp3播放的最佳实践是什么Flash mp3播放停止回音,as3,flash,actionscript-3,Flash,Actionscript 3,多次点击play,会产生回声,我无法停止mp3播放器。 mp3播放的最佳实践是什么 var mySound:Sound = new Sound(); playButton.addEventListener (MouseEvent.CLICK, myPlayButtonHandler); var myChannel:SoundChannel = new SoundChannel(); function myPlayB
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();
}
我会做几件事
2.将“播放”按钮更改为“暂停”按钮。如果按下按钮,则执行停止操作。如果他们点击暂停,则将按钮切换回播放状态。这里有两个按钮可全局控制音量。如果这不起作用,请告诉我
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_;
}