Need help with volume mute button

Hi

I can’t seem to figure out what’s happening here…
I’m creating a mute button for an audio player that I pieced together, and it seems to be working alright except when I advance to a new track.

If the volume is NOT muted and I click a new track it’s fine, but if the volume is muted (i.e. at “0”) and click a new track it remains at 0 and won’t un-mute when I click the button… though if I click the button to un-mute it and then select a new track it’s fine, so I think there’s something in my playSong() function that’s interfering, I just can’t tell what it is.

Code is:


stop();
//--------------------------------------------------------------------------
// Player Variables
//--------------------------------------------------------------------------
volume = 100;
current_song = 1;
//--------------------------------------------------------------------------
// XML Setup
//--------------------------------------------------------------------------
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = loadData;
data_xml.load("audio.xml");
// parsing all xml data into flash
function loadData(success) {
	if (success) {
		// getting all titles and filenames                        
		aPath = new Array();
		audioTracks = new Array();
		audioTracks = this.firstChild.childNodes;
		song_total = audioTracks.length;

		for (var i = 0; i<song_total; i++) {
			aPath.push(audioTracks*.attributes.path);
		}

	}
	// done ! all loaded succesfully. purging trash                                      
	delete audioTracks;
	delete data_xml;
}

//--------------------------------------------------------------------------
// List Button
//--------------------------------------------------------------------------
function listClick(prm) {
	delete pausepos;
	current_song = prm;
	MySound.stop();
	playSong();
}

//--------------------------------------------------------------------------
// Play Function
//--------------------------------------------------------------------------
function playSong() {
	AudioPath = aPath[current_song-1];
	MySound = new Sound();
	MySound.setVolume(volume);
	loadSound();
	MySound.loadSound(AudioPath,true);
	MySound.onSoundComplete = function() {
		if (current_song == 4) {
			MySound.stop();
			trace("Audio Stopped");
		} else {
			current_song == song_total ? current_song=1 : current_song++;
			playSong();
		}

	};
	trace("Playing Track "+current_song);
}

// Mute Button
var muted = false;

btnMute.onRelease = function() {
	if (!muted) {
		muted = true;
		volume = 0;
		this.gotoAndStop(2);
	} else if (muted) {
		muted = false;
		this.gotoAndStop(1);
		volume = 100;

	}
	MySound.setVolume(volume);
	trace("Volume "+volume);
};


// Playlist Buttons
btn1.onRelease = function() {listClick(1);};
btn2.onRelease = function() {listClick(2);};
btn3.onRelease = function() {listClick(3);};
btn4.onRelease = function() {listClick(4);};

and the XML is:


<?xml version="1.0" encoding="UTF-8"?>

<player>
    <song path="track1.mp3" />
    <song path="track2.mp3" />
    <song path="track3.mp3" />
    <song path="track4.mp3" />
</player>