# Stop btn for mp3s

**URL:** <https://forum.kirupa.com/t/stop-btn-for-mp3s/211377>\
**Category:** Uncategorized\
**Created:** [December 31, 2006, 1:17am UTC](https://forum.kirupa.com/t/stop-btn-for-mp3s/211377 "2006-12-31T01:17:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tubbs](https://avatars.discourse-cdn.com/v4/letter/t/58956e/32.png) [@tubbs](https://forum.kirupa.com/u/tubbs)\
**Post date:** [December 31, 2006, 1:17am UTC](https://forum.kirupa.com/t/stop-btn-for-mp3s/211377/1 "2006-12-31T01:17:08Z")

</div>

[FONT=Arial]howdy ho. i have a question on how to code a btn that enables the current mp3 that is playing to stop. I have 3 buttons that play different mp3’s using onLoad, but need help creating a btn that stops the music no matter what song is playing.  
here is the code I have:  
[/FONT]

```auto

[FONT=Arial]my_sound = new Sound();
my_sound.loadSound("songs/1.mp3", true);
var currentSong = 1;

song1_btn._alpha = 100;
song2_btn._alpha = 50;
song3_btn._alpha = 50;

song1_btn.onPress = function() {
    song1_btn._alpha = 100;
    song2_btn._alpha = 50;
    song3_btn._alpha = 50;
    my_sound.loadSound("songs/1.mp3", true);
    currentSong = 1;
};

song2_btn.onPress = function() {
    song1_btn._alpha = 50;
    song2_btn._alpha = 100;
    song3_btn._alpha = 50; 
    my_sound.loadSound("songs/2.mp3", true);
    currentSong = 2;
};

song3_btn.onPress = function() {
    song1_btn._alpha = 50;
    song2_btn._alpha = 50;
    song3_btn._alpha = 100;
    my_sound.loadSound("songs/3.mp3", true);
    currentSong = 3;
};
stop_music_btn.onPress = function() {
  ????
};[/FONT]

```

i made the variable ‘currentSong’ that gets set for whatever song is playing, and think that might be a way to get the music to stop. If anyone has any suggestions that would be awesome. You guys rule. Thanks for all the help.
