【发布时间】:2016-09-21 10:36:19
【问题描述】:
目前尝试在我的 Actionscript 3 项目中无休止地循环播放声音片段(将 mp3 导入库)。这是我目前的设置:
var sound:Sound = new bgm();
function playSound():void
{
var channel:SoundChannel = sound.play(80);
channel.addEventListener(Event.SOUND_COMPLETE, onComplete);
}
function onComplete(event:Event):void
{
SoundChannel(event.target).removeEventListener(event.type, onComplete);
playSound();
}
//end loop
这不会报告任何错误;但是它也不播放任何声音。我错过了什么吗?我是否需要在 .fla 中导入某些内容才能注册声音?
感谢您的帮助
【问题讨论】:
-
解决了吗?请将答案标记为正确。就像@Null 所说,您必须通过在代码中的某处放置
playSound();来运行playSound函数,在var sound:Sound = new bgm();之后尝试下一行。也不需要 80 只需使用sound.play();因为它会在声音播放完成时重复...
标签: actionscript-3 loops flash audio actionscript