Playing Sound on Keydown?

How do u make a sound play when any key is pressed???
thnx

I believe you make a button/movie clip.

Then open your actions Panel - choose movie control>on>and the keypresses are below :slight_smile: - Choose play your sound after that

Hope I helped :slight_smile:

Could u give me the actual actionscript please…

on (keyPress "<Left>";
gotoAndPlay(1);
) {
}

Thats just for the left key, and youll have to define what frame you will go to on your own :stuck_out_tongue:

what about on Keydown so when any key is pressed to play sound and i dont want to goto another frame…

[AS]myListener = new Object();
myListener.onKeyDown = function () {
//do your stuff here
}
Key.addListener(myListener);[/AS]

im sorry but I still dont understand… how would i play a wav file named say bleep.wav that was imported to my library. how would i play this everytime a key was down??

I dont understand much of the sound object but ill give it a try:[AS]mySound = new Sound();
mySound.attachSound(“bleep”);
myListener = new Object();
myListener.onKeyDown = function() {
mySound.start();
};
Key.addListener(myListener);[/AS] Where “bleep” is the linkage identifier to your sound.

I assume you want to use a specific key to play the sound… ?
[AS]mySound.onKeyDown = function() {
if (Key.isDown(/* insert key code value here */)) {
this.start();
}
};[/AS]
See Keyboard Keys and Key Code Values in Using Flash (F1) for a complete list of key code values.

cool thanks …
how do i set the volume??

http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary668.html

also the sounds is like lagging
how do i fix this???
get a shorter sound??