I'm working on a Flash game and am trying to figure out how to repeat a sound periodically every 17 seconds. Instead, of having the sound repeat once the .mp3, .wav, finishes.
The problem I'm running into is the sound is repeating itself after the song finishes, and the timer isn't doing anything. I put the timer in the initTitle area because I'm working on my main menu, and then I initialize the sound, and read if the sound finishes. How can I get it so that sound repeats every 17 seconds?
public function initTitle():void
{
initSoundThemeSong();
initTitleWhooshSound();
drawTitleBG();
drawTitleLogo();
drawTitleBGStars();
drawTitleStart();
titleWhooshTimer = new Timer ( 17000 );
titleWhooshTimer.addEventListener( TimerEvent.TIMER, onTitleWhooshFinished );
titleTimer.start();
}
public function initTitleWhooshSound():void
{
titleWhoosh = new TitleSoundWhoosh();
titleWhooshSoundChannel = titleWhoosh.play();
titleWhooshSoundChannel.addEventListener( Event.SOUND_COMPLETE,
onTitleWhooshFinished );
}
public function onTitleWhooshFinished( event:Event ):void
{
titleWhooshSoundChannel = titleWhoosh.play();
titleWhooshSoundChannel.addEventListener( Event.SOUND_COMPLETE,
onTitleWhooshFinished );
}
Thanks! :)