Controlling sounds

Dear all,

I am trying to control a sound I am using as background. I got a button which I want to push to stop and play the music. I am not sure if next code is the right one to achieve this task

var channel:SoundChannel = mySound.play();
controlMusic (); //sound off
controlMusic (); //sound on

function controlMusic (){
	var transformSound:SoundTransform = channel.soundTransform
	if (transformSound.volume == 0){
		transformSound.volume =1;
		}
		else {
			  transformSound.volume = 0;
		}
	channel.soundTransform = transformSound;
}

I was looking for some way to detect if a sound is playing but I only got this volume idea

I will appreciate your feedback