Audio 在Actionscript 3中单击鼠标停止声音
所以我有这个代码,我希望当我点击开始按钮时声音停止,但是当我点击开始按钮时声音没有停止,但是音量减小了,这很奇怪。有人能解决这个问题吗Audio 在Actionscript 3中单击鼠标停止声音,audio,actionscript,Audio,Actionscript,所以我有这个代码,我希望当我点击开始按钮时声音停止,但是当我点击开始按钮时声音没有停止,但是音量减小了,这很奇怪。有人能解决这个问题吗 var mySound:Sound = new Sound(); mySound.load(new URLRequest("Sounds/Sound.mp3")); var channel:SoundChannel = mySound.play(); channel = mySound.play(); StartButton.addEventListen
var mySound:Sound = new Sound();
mySound.load(new URLRequest("Sounds/Sound.mp3"));
var channel:SoundChannel = mySound.play();
channel = mySound.play();
StartButton.addEventListener(MouseEvent.CLICK, StartGame);
function StartGame(e:MouseEvent):void
{
channel.stop();
gotoAndPlay(2);
}
好的,您已经在队列中初始化了通道
var channel:SoundChannel = mySound.play();
然后,您(可能是意外地)重新赋予它一个值:
channel = mySound.play();
你会发现如果你去掉最后一行代码,代码就可以正常工作了