# Make a sound on press/ counter

**URL:** https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417
**Category:** Uncategorized
**Created:** [December 22, 2003, 5:23pm UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417 "2003-12-22T17:23:12Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Nick](https://forum.kirupa.com/u/Nick)
#### Post date: [December 22, 2003, 5:23pm UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/1 "2003-12-22T17:23:12Z")

</div>

Hey, I have a problem. check out the .fla. I want the crosshair to make a sound when it shoots (on press). can somebody tell me how to do it or fix it up? the problem is that I can either make the sound happen or have the window break, but not both at once…please help!

PS. the sound is included in the library (usp1).

---

<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: [December 22, 2003, 6:46pm UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/2 "2003-12-22T18:46:16Z")

</div>

hmm it looks fine to me. When I shot the window broke and the sound happened? Whats wrong with it?

---

<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: [December 22, 2003, 7:03pm UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/3 "2003-12-22T19:03:53Z")

</div>

In your library, select usp1, goto “Linkage” and choose “export for first frame”, then give it an idname (I used “klik”)  
Then select your crosshair mc (“follow”) and put this AS on it:  
[AS]onClipEvent (load) {  
mySound=new Sound;  
mySound.attachSound(“klik”);  
}  
onClipEvent (mouseDown) {  
mySound.start();  
}[/AS]  
now you have both sounds;)

scotty :?)  
(btw I couldn’t find your usp1 sound)

---

<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: [December 23, 2003, 1:28am UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/4 "2003-12-23T01:28:10Z")

</div>

scotty thx a lot man, u r a genious! :thumb: i spent so much time trying different things, thx again!

---

<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: [December 23, 2003, 8:34am UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/5 "2003-12-23T08:34:23Z")

</div>

LOL, I’m just a simple soul, but you"re welcome;)

---

<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: [December 24, 2003, 3:39am UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/6 "2003-12-24T03:39:04Z")

</div>

I ran into a little trouble again. Can anybody tell me how I can make a tracking device for Hit Points in a game? For example: you start off with 100 hp and on a certain event (press a button or whatever) you lose 20 hp and are left with 80 hp. Then, when you have 0 or less HP you are taken to a certain frame which displays the test “game over”. thx in advance.

PS I saw a tutorial for this on a site but I lost the link.

---

<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: [December 24, 2003, 10:53am UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/7 "2003-12-24T10:53:53Z")

</div>

I’ve made something for you;)

scotty:?)

---

<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: [December 24, 2003, 5:41pm UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/8 "2003-12-24T17:41:18Z")

</div>

scotty man you’re great. i dont know how to thank you. you saved me so much time. 🍺 merry christmas bro.

---

<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: [December 24, 2003, 5:54pm UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/9 "2003-12-24T17:54:06Z")

</div>

No problem;)

Merry Xmas too

---

<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: [December 24, 2003, 8:44pm UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/10 "2003-12-24T20:44:31Z")

</div>

one more question. check out the **shooting.fla**. how can I prevent the mouse from firing and breaking the window when there are no bullets left? thanks in advance. :thumb:

---

<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: [December 24, 2003, 9:51pm UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/11 "2003-12-24T21:51:44Z")

</div>

Skip the code on the “glassbutton”.  
Give your glassmc (“window2\_movie”) an instancename “mc\_glass”, then change your “gun.onMouseDown” code in:  
[AS]gun.onMouseDown = function() {  
if (ammunition.ammo) {  
this.play();  
shot.start();  
ammunition.nextFrame();  
if (sights.hitTest(mc\_glass)) {  
mc\_glass.gotoAndPlay(2);  
}  
} else {  
empty.start();  
}  
};[/AS]

scotty(-:

---

<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: [December 24, 2003, 10:06pm UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/12 "2003-12-24T22:06:39Z")

</div>

good idea, thx! :thumb: but i cant get it right. for me, the window can be shot more than once.

---

<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: [December 24, 2003, 10:24pm UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/13 "2003-12-24T22:24:26Z")

</div>

Ehm, I think I misunderstood you.  
Try to explain again what you want=)

scotty(-:

---

<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: [December 25, 2003, 5:34pm UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/14 "2003-12-25T17:34:31Z")

</div>

when I followed your instructions, I could click on the glass and it would break then I could click on it again and it would break again but I want it to break once and remain broken. I probably followed your instructions incorrectly. I’ll try again in a few days but for now its the holidays and im taking a break. Merry Christmas & thx for the help. I have to go and enjoy my presents now…MP3 player. 🍺

---

<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: [December 25, 2003, 8:51pm UTC](https://forum.kirupa.com/t/make-a-sound-on-press-counter/38417/15 "2003-12-25T20:51:07Z")

</div>

Nick, you followed the instructions correctly, I will have a second look.  
Enjoy your holidays and mp3 player;)

scotty(-:
