|
-
Relaxing
sound with key press
How do I get sound to activate with a key press? I can get objects to move around the screen. But I want a sound to happen when I press a key. And would I import the sound?
Any programming language is at its best before it is implemented and used.
-
undead creature
Do in this way:
1)Create an empty movie clip with 4 keyframes named "snd"
2)Insert STOP for keyframes 2 and 4
3)Add the desired sound on keyframe 3
4)In the main timeline add this script:
if(Key.isDown(what you need)) {_root.snd.gotoAndPlay(3);}
that's all !
-
Relaxing
Originally posted by necromanthus
Do in this way:
1)Create an empty movie clip with 4 keyframes named "snd"
2)Insert STOP for keyframes 2 and 4
3)Add the desired sound on keyframe 3
4)In the main timeline add this script:
if(Key.isDown(what you need)) {_root.snd.gotoAndPlay(3);}
that's all !
I can not get this to work
I create a new movie clip. then create 4 keyframes. in frame 3 i added sound and used stop movie for 2 and 4.
in the main movie I went to sound and actions and added
if(Key.isDown(key.SPACE)) {_root.snd.gotoAndPlay(3);}
In the main movie i changed the mc name to snd.
any suggestions?
Thank you.
Any programming language is at its best before it is implemented and used.
-
Just a thought - I had a problem with keyboard stuff, until Hilary advised me to first click in the movie (to give it focus). Thereafter it knows the keys are for it (or at least until you click outside the movie and transfer focus elsewhere).
-
Relaxing
Originally posted by OwenAus
Just a thought - I had a problem with keyboard stuff, until Hilary advised me to first click in the movie (to give it focus). Thereafter it knows the keys are for it (or at least until you click outside the movie and transfer focus elsewhere).
I tried the focus. It is something simple. I need to sleep on it.
This is for an old arcade style game that I am about half way thru. I want a laser sound when a laser is fired with the space key.
Last edited by tmoore935; 11-13-2002 at 11:52 PM.
Any programming language is at its best before it is implemented and used.
-
undead creature
I don't know what are you doing wrong.
Works perfect for me !
OK ... try this modification:
1) delete the command line from the main timeline.
2) add this script for the child-movie "snd":
onClipEvent(enterFrame){
if(Key.isDown(key.SPACE)){this.gotoAndPlay(3);}
}
cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|