Actionscript 3 在声音结束后转到并播放3

Actionscript 3 在声音结束后转到并播放3,actionscript-3,flash,actionscript,air,Actionscript 3,Flash,Actionscript,Air,我想我的时间线前进到某个标记帧后,声音完成。以下是我目前掌握的代码: var n1Channel:SoundChannel = new narratorAlphabetSounds(); n1Channel.addEventListener(Event.SOUND_COMPLETE, audioComplete); function audioComplete(e:Event):void { gotoAndPlay("step2"); } 声音加载失败,尝试测试时出错。有什么建议吗?谢谢

我想我的时间线前进到某个标记帧后,声音完成。以下是我目前掌握的代码:

var n1Channel:SoundChannel = new narratorAlphabetSounds();
n1Channel.addEventListener(Event.SOUND_COMPLETE, audioComplete);
function audioComplete(e:Event):void
{
gotoAndPlay("step2");  
}

声音加载失败,尝试测试时出错。有什么建议吗?谢谢

您得到了隐式强制错误,因为您的
叙述者声音
对象是一个对象而不是一个。。然后,要播放声音并在播放结束时进行检测,应使用
声音
声音频道
对象,如下所示:

var sound:Sound = new narratorAlphabetSounds();

var sound_channel:SoundChannel = sound.play();
    sound_channel.addEventListener(Event.SOUND_COMPLETE, audioComplete);

function audioComplete(e:Event):void 
{
    trace('audio complete');
}

希望这能有所帮助。

你能把你得到的错误放在这里吗?这里是错误:1067:隐式强制类型为“讲述人”的值指向一个不相关的类型flash。媒体:SoundChannel。这个答案非常有用。我现在明白了,并且已经能够用这段代码成功地完成我的目标。非常感谢你!