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 - Choose play your sound after that
Hope I helped
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
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??
also the sounds is like lagging
how do i fix this???
get a shorter sound??