Stop music in flash presentation

Hello, i have this flash presentation that i’m working on, i have a “stop” and “play” button and i have a layer with music. What i’ve noticed is that when i click the “stop” button the music keeps on playing.

What i want is that when i click the stop button the music stops too. How can i do that?

thank you very much.

put this on the stop button :


on(release){
stopAllSounds();
}

i am assuming you put the actionscript directly on the buttons . if not i hope you can change your code accordingly.

Thanks for your answer. Yes, i have my actionscript directly on the button.

And when i click the “play” button, does the music starts again? or should i put something extra in the actionscript for the play button?

Thanks again.

no , the music starts again.
that function stopAllSounds() does exactly what it says . stopping every sound in the file . but of course you can trigger 'em to play again after.

thanks krityx, the music stops now when i click the stop button, but when i click play, the movie resumes but not the music. I think i should put something in the actionscript for the play button.

This is the actionscript i have on the play button:

on(release) {
play();
}

well play(); function just tells the timeline to go on playing .you need somehow to control your sound . i would recommend it making it via actionscript but if you’re not too experienced with actionscript you could put the sound in a movie clip and them tell that movie clip with the sound to play . this of course gives you less control over the sound but if you want just a simple background sound that can be triggered on and off that is sufficient.

so make a movieclip and put the sound on the first frame of the movie clip . then when you want to play the music you need to write something like this on the button

on(release){
myMc.play();
}
myMc of course is the instance name that you give to the movie clip containing the song.you can change that of course.

The stop buttons remains the same.