# Playbutton change after finished playing?

**URL:** https://forum.kirupa.com/t/playbutton-change-after-finished-playing/313654
**Category:** flash
**Created:** [September 6, 2010, 11:49am UTC](https://forum.kirupa.com/t/playbutton-change-after-finished-playing/313654 "2010-09-06T11:49:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![DrViolet](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@DrViolet](https://forum.kirupa.com/u/DrViolet)
#### Post date: [September 6, 2010, 11:49am UTC](https://forum.kirupa.com/t/playbutton-change-after-finished-playing/313654/1 "2010-09-06T11:49:36Z")

</div>

I have a simple Flash-player button (toggle play/stop) that plays MP3s. When I press play the MP3 starts and the button changes to stop. When I press again the music stops and the stop-button changes to play.

I have several player-buttons on my page. How do I stop all sounds when I press play on one of the buttons? As of now, I can start several MP3 at the same time and I don’t want that. I’ve tried this:

```
Code:
import flash.media.SoundMixer;

```

SoundMixer.stopAll();  
but it doesn’t work out. Do I need to number the players somehow?

Also, when the MP3 has finished playing it should turn into a play button. As of right now it’s a stop-button when it’s finished playing. How do I change it to a play-button?

This is the Actionscript 3 code:

```
Code:
var flashVars=this.root.loaderInfo.parameters;

```

var loadSnd:URLRequest = new URLRequest(flashVars.myVar);  
var thisSnd:Sound = new Sound();

var sndTrans: SoundChannel = new SoundChannel();

thisSnd.load(loadSnd);

play\_btn.addEventListener(MouseEvent.CLICK,playF);  
stop\_btn.visible = false;  
stop\_btn.addEventListener(MouseEvent.CLICK,stopF);

function playF(event:MouseEvent): void{

sndTrans = thisSnd.play();  
play\_btn.visible = false;  
stop\_btn.visible = true;

}

function stopF(event:MouseEvent): void{

sndTrans.stop();  
stop\_btn.visible = false;  
play\_btn.visible = true;  
}
