这是我的问题
在我的主舞台上,我添加了这段代码以进行声音重复,它在这个舞台上运行良好并且循环良好
var HP1sound:Sound = new HP_sound();
var HP_channel:SoundChannel = new SoundChannel();
function playSound():void
{
HP_channel=HP1sound.play();
HP_channel.addEventListener(Event.SOUND_COMPLETE, onComplete);
}
function onComplete(event:Event):void
{
SoundChannel(event.target).removeEventListener(event.type, onComplete);
playSound();
}
playSound();
但是,我已将代码添加到另一个页面(并更改了所有变量)并且正确的声音播放一次正确,但是,当它应该循环播放第一阶段的声音时。(第二页代码如下所示)
var Crow_sound2:Sound = new Crow_sound();
var Crow_channel:SoundChannel = new SoundChannel();
function playSound2():void
{
Crow_channel=Crow_sound2.play();
Crow_channel.addEventListener(Event.SOUND_COMPLETE, onComplete);
}
function onComplete2(event:Event):void
{
SoundChannel(event.target).removeEventListener(event.type, onComplete);
playSound2();
}
playSound2();
所以它在重复播放声音 playSound2 它播放 playSound
任何帮助将不胜感激谢谢