# Possible to add sound on mouse click?

**URL:** https://forum.kirupa.com/t/possible-to-add-sound-on-mouse-click/3777
**Category:** programming
**Created:** [September 19, 2001, 1:51pm UTC](https://forum.kirupa.com/t/possible-to-add-sound-on-mouse-click/3777 "2001-09-19T13:51:30Z")
**Posts on this page:** 4
**Page:** 1

<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: [September 19, 2001, 1:51pm UTC](https://forum.kirupa.com/t/possible-to-add-sound-on-mouse-click/3777/1 "2001-09-19T13:51:30Z")

</div>

Hello,  
What I have is a mouse cursor as a crosshair, and when I click I want it to play a gunshot sound. What I did was make the background a button and attached the sound.

So what I want to do is avoid making the background a button, can I attach the sound so it plays when I left click the mouse?

Thanks all.

Bye…

---

<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: [September 19, 2001, 2:06pm UTC](https://forum.kirupa.com/t/possible-to-add-sound-on-mouse-click/3777/2 "2001-09-19T14:06:29Z")

</div>

Put the sound in the “down” state of the button. That’s the button’s third frame. It will play every time the button is pressed.

---

<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: [September 19, 2001, 3:40pm UTC](https://forum.kirupa.com/t/possible-to-add-sound-on-mouse-click/3777/3 "2001-09-19T15:40:38Z")

</div>

or, what you could do to eliminate the whole backg button is to make a blank MC, put it on the main stage, and give it this sorta actionscript:

onClipEvent(load) {  
snd = new Sound();  
snd.attachSound(“sound name”);  
}  
onClipEvent(mouseDown) {  
snd.start();  
}

---

<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: [September 21, 2001, 10:37am UTC](https://forum.kirupa.com/t/possible-to-add-sound-on-mouse-click/3777/4 "2001-09-21T10:37:13Z")

</div>

You know… I need to read more about the sound object. I really don’t understand more than the basics of that. Can you start a thread in Action Script forum and give what ever details you have on it?
