Actionscript 3 为什么从SOUND.length位置开始播放时SOUND_未完成触发的事件?
我意识到,当从SOUND.length位置开始播放时,不会触发Event.SOUND\u COMPLETE事件。在实现scriber时,可以使用它:用户可以搜索到100%并开始播放 这是虫子吗?解决这个问题的常见做法是什么 复制此行为的示例代码:Actionscript 3 为什么从SOUND.length位置开始播放时SOUND_未完成触发的事件?,actionscript-3,Actionscript 3,我意识到,当从SOUND.length位置开始播放时,不会触发Event.SOUND\u COMPLETE事件。在实现scriber时,可以使用它:用户可以搜索到100%并开始播放 这是虫子吗?解决这个问题的常见做法是什么 复制此行为的示例代码: import flash.media.Sound; import flash.media.SoundChannel; private var sound:Sound; private var channel:SoundChannel; public
import flash.media.Sound;
import flash.media.SoundChannel;
private var sound:Sound;
private var channel:SoundChannel;
public function test():void {
sound = new Sound();
sound.addEventListener(Event.COMPLETE, testLoadingCompleteHandler);
sound.load(new URLRequest("/song.mp3"));
}
private function testLoadingCompleteHandler(event:Event):void {
// SOUND_COMPLETE doesn't fire when we start playing from sound.length position
trace("# testSoundLoadingCompleteHandler()");
channel = sound.play(sound.length);
channel.addEventListener(Event.SOUND_COMPLETE, testPlaybackCompleteHandler);
}
private function testPlaybackCompleteHandler(event:Event):void {
// This message won't be printed because SOUND_COMPLETE event isn't fired
trace("# testPlaybackCompleteHandler()");
}
可能sound.playsound.length不会开始播放,甚至返回错误。我想可能是因为sound.length大于允许值。与在数组中一样,不能使用数组[array.length],因为它将超出范围
我重新编译triyng array.length-1我刚刚测试了sound.playsound.length返回的内容。它会按应有的方式返回SoundChannel。目前,我开始从sound.length播放,正如你所建议的,是1毫秒,效果很好。谢谢