AS3: stopping sound from overlapping


How can I control sound in flash so that:

  1. the music starts when the user clicks on a play button but when they click on the play button again while the music is playing, the music DOESN’T overlap??
  2. the music doesn’t overlap when going back to the homepage where the music first started playing??
    I’m currently using the code below but the music overlaps when I press the play button more than once while the music is playing and when I go back to the page where the music started playing…:o
var mySound:Sound = new Sound();
var myChannel:SoundChannel = new SoundChannel();
var lastPosition:Number = 0; // pause button
mySound.load(new URLRequest("that_tune.mp3"));
myChannel =;
stop_but.addEventListener(MouseEvent.CLICK, onClickStop);
function onClickStop(e:MouseEvent):void{
pause_but.addEventListener(MouseEvent.CLICK, onClickPause);
function onClickPause(e:MouseEvent):void{
lastPosition = myChannel.position;
play_but.addEventListener(MouseEvent.CLICK, onClickPlay);
function onClickPlay(e:MouseEvent):void{
myChannel =;

I appreciate any help you can give me!!