Hi
I want an mp3 stream to start playing once a separte swf has finished loading.
I have set up a listener for the swf. Inside the onLoadComplete function I have added some code for the mp3 streaming.
I am pretty sure that the listener is working, since other events aren’t triggered wrongly. However…
Sometimes the sound clip starts to play (and shows as 100% loaded) and then jumps back to the start, and the loader whizzes down. It doesn’t appear to play before the swf is loaded though…
mclListener.onLoadComplete = function(target_mc:MovieClip, status:Number):Void {
//trace("loaded");
:
:
//get soundUrl
soundToLoad.loadSound(episode+"/"+soundUrl, true);
soundToLoad.onLoad = function () {
this.start(0, 1);
createSoundInterval();
}
}//end onLoadComplete
function createSoundInterval():Void{
soundIntervalID = setInterval( this, "soundProgress", soundInterval);
trace ("sound interval"+soundIntervalID);
}
function soundProgress():Void{
var soundPercent:Number = Math.round(100*(soundToLoad.position/soundToLoad.duration));
soundControl.loaderBar._width=300*soundPercent/100;
//trace (soundPercent+"%");
if (soundPercent >=100){
clearInterval(soundIntervalID);
}
}
Oddly the trace soundIntervalID shows that sometimes more than 1 interval is being created.
What can I do to ensure the mp3 only plays once?
thanks
E
PS if you want you can see teh offedning beast at www.ee-web.co.uk/ase/index.html - only the first 3 buttons have sound clips associated with them