Make a sound on press/ counter

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).

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

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)

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

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

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.

I’ve made something for you;)

scotty:?)

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

No problem;)

Merry Xmas too

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:

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(-:

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

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

scotty(-:

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. :beer:

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

scotty(-: