var audioLink01:URLRequest = new URLRequest("DanceOfTheMist.mp3");
var sound01:Sound = new Sound();
var soundChannel01:SoundChannel;
var soundPausedPos:int;
var soundIsPlaying:Boolean;
this.loaderInfo.addEventListener(Event.COMPLETE, init);
function init(e:Event) {
//trace("The init function has run");
sound01.load(audioLink01);
mute_mc.addEventListener(MouseEvent.CLICK, muteSounds);
play_mc.addEventListener(MouseEvent.CLICK, playSounds);
}
function playSounds(e:MouseEvent) {
if(soundIsPlaying == true) {
}else{
soundChannel01 = sound01.play(soundPausedPos);
soundIsPlaying = true;
soundChannel01.addEventListener(Event.SOUND_COMPLETE, updateSoundStatus);
}
}
function muteSounds(e:MouseEvent) {
soundPausedPos = soundChannel01.position;
soundChannel01.stop();
soundIsPlaying = false;
}
function updateSoundStatus(e:Event) {
soundIsPlaying = false;
}