【问题标题】:ActionScript 3.0; looping audiofiles动作脚本 3.0;循环音频文件
【发布时间】: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


【解决方案1】:

你必须首先调用函数playSound()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-05
    • 2013-06-22
    • 1970-01-01
    • 2021-05-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多