Deleting onEnterFrame, but need it again

Hey all,

I’m a bit stumped and any help is appreciated.

Here we go…
I have an external button talking to a Flash variable (mute). Based on the ‘mute’ value (either true or false), the audio will mute. So I have that code in an onEnterFrame function constantly waiting for the ‘mute’ variable to change.

But I also need the audio to pause when the external mute button is clicked. And when the ‘mute’ button is clicked again to play the audio, I want the audio to pick right up where it left off.

I can get everything to work EXCEPT for the audio to play where it left off. As you can see in my code, if I use the start method with the audio position as an argument for my audio in the onEnterFrame function, it just constantly repeats the audio…not good.

Anyways, any help to control the audio based on a variable passed when a button is clicked would be appreciated.

Here is my code…

ActionScript Code:
[AS]
[LEFT][FONT=Courier New]var narrSound:Sound = new Sound();
narrSound.attachSound(“sndSound”);
narrSound.start();
var sndDuration:Number = narrSound.position/1000;
trace(narrSound.position);
var mute = “false”;
narrSound.start();[/FONT][/LEFT]
[FONT=Courier New][LEFT]
this.onEnterFrame = function()
{
if (mute == “false”)
{
narrSound.setVolume(100);
narrSound.start(sndDuration);
}
else
{
narrSound.setVolume(0);
narrSound.stop();
}
}
[/FONT][FONT=Courier New][/AS][/FONT][/LEFT]