In order to stop and restart a sound you need to play it through a channel. In order to notice, you need a fairly long sound.
In this example we used Sports Basketball Dribble and Shoot in Gym 01.

Write the code as shown below:
var sound:BasketBall=new BasketBall(); //get a fairly long sound in the library or off the internet
var channel:SoundChannel;
var curPos: int=0;
var playing:Boolean=false;
btnBack.addEventListener(MouseEvent.CLICK,goBack);
btnPause.addEventListener(MouseEvent.CLICK,goPause);
btnPlay.addEventListener(MouseEvent.CLICK,goPlay);
this.addEventListener(Event.ENTER_FRAME,frames);
function frames(e:Event):void {
if(playing) {
curPos=channel.position;
}
txtPos.text=""+curPos;
}
function goPlay(e:MouseEvent):void {
channel = sound.play(curPos);
playing=true;
}
function goBack(e:MouseEvent):void {
if(playing) {
channel.stop();
}
playing=false;
curPos=0;
}
function goPause(e:MouseEvent):void {
if(playing) {
curPos=channel.position;
channel.stop();
playing=false;
} //stop playing
} //go pause
Download the finished movie
INDEX, Timer Class, Sound Class, URLRequest to play a sound, Start and Stop a Sound with a Channel, URLRequest to Open the Browser, Add New Child at Runtime, List to download classes
Next lesson: Document Class