当回到 as3 中开始的帧时,如何停止多次播放音乐?
How can I stop music from playing multiple times when going back to the frame it starts from in as3?
我有一个从第一帧开始并在整个应用程序中播放的音乐曲目。当我回到第一帧时,当前音乐仍在播放,但歌曲再次从头开始播放。我怎样才能让它即使在回到那个帧后也只播放一次?
我的代码:
var mySound:Sound = new Sound();
var myChannel:SoundChannel = new SoundChannel();
mySound.load(new URLRequest("Stellardrone - Billions And Billions.mp3"));
myChannel = mySound.play();
SoundMixer.soundTransform = new SoundTransform(0.4);
您可以检查一下声音(或声道)是否已经创建:
var mySound:Sound;
var myChannel:SoundChannel;
if(!mySound){
mySound = new Sound();
mySound.load(new URLRequest("Stellardrone - Billions And Billions.mp3"));
myChannel = mySound.play();
SoundMixer.soundTransform = new SoundTransform(0.4);
}
我有一个从第一帧开始并在整个应用程序中播放的音乐曲目。当我回到第一帧时,当前音乐仍在播放,但歌曲再次从头开始播放。我怎样才能让它即使在回到那个帧后也只播放一次?
我的代码:
var mySound:Sound = new Sound();
var myChannel:SoundChannel = new SoundChannel();
mySound.load(new URLRequest("Stellardrone - Billions And Billions.mp3"));
myChannel = mySound.play();
SoundMixer.soundTransform = new SoundTransform(0.4);
您可以检查一下声音(或声道)是否已经创建:
var mySound:Sound;
var myChannel:SoundChannel;
if(!mySound){
mySound = new Sound();
mySound.load(new URLRequest("Stellardrone - Billions And Billions.mp3"));
myChannel = mySound.play();
SoundMixer.soundTransform = new SoundTransform(0.4);
}