# Background sound and button sounds

**URL:** <https://forum.kirupa.com/t/background-sound-and-button-sounds/27988>\
**Category:** Uncategorized\
**Created:** [August 8, 2003, 5:35pm UTC](https://forum.kirupa.com/t/background-sound-and-button-sounds/27988 "2003-08-08T17:35:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paisley](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@paisley](https://forum.kirupa.com/u/paisley)\
**Post date:** [August 8, 2003, 5:35pm UTC](https://forum.kirupa.com/t/background-sound-and-button-sounds/27988/1 "2003-08-08T17:35:51Z")

</div>

I made 2 sounds: background and button sound.

This is the code:

\_root.onLoad = function() {  
backgroundSound = new Sound(this);  
backgroundSound.attachSound(“sound\_root”);  
backgroundSound.start();  
buttonSound = new Sound(button0);  
buttonSound.attachSound(“sound\_button”);  
}  
\_root.onEnterFrame = function() {  
backgroundSound.onSoundComplete(backgroundSound.start());  
}  
button0.onRelease = function() {  
buttonSound.start();  
}

The problem is the background sound plays but when I click on the button, the button sound doesn’t play.

Did I do something wrong?

Help, please. Thanks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 8, 2003, 8:25pm UTC](https://forum.kirupa.com/t/background-sound-and-button-sounds/27988/2 "2003-08-08T20:25:42Z")

</div>

try

[AS]  
button0.onRelease = function() {  
button0.buttonSound.start();  
}  
[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 8, 2003, 9:04pm UTC](https://forum.kirupa.com/t/background-sound-and-button-sounds/27988/3 "2003-08-08T21:04:17Z")

</div>

It didn’t work. Any other suggestions?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 8, 2003, 9:25pm UTC](https://forum.kirupa.com/t/background-sound-and-button-sounds/27988/4 "2003-08-08T21:25:42Z")

</div>

should work :

```auto
_root.onLoad = function() {
backgroundSound = new Sound(this);
backgroundSound.attachSound("sound_root");
backgroundSound.start();
buttonSound = new Sound(this);
buttonSound.attachSound("sound_button");
}
_root.onEnterFrame = function() {
backgroundSound.onSoundComplete(backgroundSound.start());
}
button0.onRelease = function() {
buttonSound.start();
}

```
