简体   繁体   中英

ActionScript 3.0; looping audiofiles

Currently trying to loop a sound clip (imported mp3 to library) endlessly in my Actionscript 3 project. This is my current set up:

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

This doesn't report any errors; however it doesn't play any sounds either. Am I missing something? Do I need to import something to the .fla before it can register the sound?

Thank you for any help

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM