import flash.external.ExternalInterface;
snd = new Sound();
snd.load(new URLRequest('music.mp3'));
snd.addEventListener("complete", function(evt:Event){ chnl = snd.play(0,stage.loaderInfo.parameters.noloop?0:1000); });
ExternalInterface.addCallback("on", on);
function on(str):void {
snd.play();
}
ExternalInterface.addCallback("off", off);
function off(str):void {
chnl.stop();
}
So, it runs, loads the mp3, and plays on complete. I call the off function, and it works.
I call the on function, and it works.
Call the off function again, and it doesn’t work!
I have tried snd.play(); and chnl = snd.play(); in the on function, neither work. Any ideas?