# mp3 sound - play and stop

**URL:** <https://forum.kirupa.com/t/mp3-sound-play-and-stop/187828>\
**Category:** flash\
**Created:** [May 2, 2006, 5:08pm UTC](https://forum.kirupa.com/t/mp3-sound-play-and-stop/187828 "2006-05-02T17:08:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Only\_Dust](https://avatars.discourse-cdn.com/v4/letter/o/f1d935/32.png) [@Only\_Dust](https://forum.kirupa.com/u/Only_Dust)\
**Post date:** [May 2, 2006, 5:08pm UTC](https://forum.kirupa.com/t/mp3-sound-play-and-stop/187828/1 "2006-05-02T17:08:42Z")

</div>

I made to player with only the buttons play and stop, I tried to make that button toggle, but I did not works, then I made two buttons, when I click in play it shows a button and hides the other and vice versa, he functions normal, my problem is the following one:  
When finishes the music the button not return for stop button, it continues showing to the animation of the play button , How can I make when to finish the music the button comes back to the state where it was.  
AS  
[AS]  
var mp3Musica:Sound = new Sound ();  
//  
tocar\_mc.\_visible = true;  
parar\_mc.\_visible = false;  
//tocar música  
tocar\_mc.onPress = function () {  
tocar\_mc.\_visible = false;  
parar\_mc.\_visible = true;  
mp3Musica.onLoad = function (sucesso:Boolean) {  
if (sucesso) {  
mp3Musica.start ();  
}  
};  
// carregar música  
mp3Musica.loadSound (\_root.musica, true);  
};  
//parar musica  
parar\_mc.onPress = function () {  
tocar\_mc.\_visible = true;  
parar\_mc.\_visible = false;  
mp3Musica.onLoad = function (sucesso:Boolean) {  
if (sucesso) {  
mp3Musica.stop ();  
}  
};  
mp3Musica.loadSound (\_root.musica, true);  
};  
//cor fundo botao  
new Color (tocar\_mc.fundo1\_mc).setRGB (parseInt (cf, 16));  
new Color (parar\_mc.fundo2\_mc).setRGB (parseInt (cf, 16));  
[/AS]

Sorry about my English
