Hi,
I’m playing an external sound in flash using AS3, everything loads and plays ok, but i want to go to another label on my timeline when the sound has stopped playing.
I have attempted to do this by using Event.SOUND_COMPLETE but i have failed to make it work.
Please help, see my code below.
cheers,
Bazz
import flash.events.Event
import flash.events.MouseEvent;
import flash.media.SoundChannel;
var isPlaying:Boolean = new Boolean();
var pausePosition:Number = new Number();
var soundIntro:Sound = new Sound();
var sndChannel:SoundChannel = new SoundChannel();
soundIntro.load(new URLRequest(“audio/intro.mp3”));
soundIntro.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
function onComplete(evt:Event):void {
//Play loaded sound
sndChannel = soundIntro.play();
isPlaying = true;
}
soundIntro.addEventListener(Event.SOUND_COMPLETE,soundCompleteHandler);
function soundCompleteHandler(event:Event):void {
trace('soundCompleteHandler called');
MovieClip(root).gotoAndPlay('fr');
}