How can i make it so that when u press A, a sound will play
the easiest way i know is to import the sound in a movie clip and give it an instance name sound(example: sound)
put a stop action in the first frame of the movie clip
then make a button and copy paste this:
on(release){
_root.sound.play();
}
http://kennybellew.com/tutorial/
scotty(-:
onEnterFrame = function () {
if (Key.isDown(65)) {
thing = new Sound();
thing.attachSound("sound.wav");
thing.start();
}
};
You have to export “sound.wav” for actionsript
Combine that with the Key class and you have what you’re after:
var snd:Sound = new Sound(this);
snd.attachSound("mySound");
Key.addListener(snd);
snd["onKeyDown"] = function ():Void {
if (String.fromCharCode(Key.getCode()) == "A") {
this.start();
}
};
:hoser:
I tried the one that looked simple
on(release){
_root.sound.play();
}
But the only problem is that when i click on the button it wont play … Do i have to do somethign with the linkage or something,
also i read the Tuts but it didnt help as much as u guys did >.<
did you put the sound into the movieclip?
maybe you missed the instance name. it worked fine for me
btw, make it on(press)
Yes i put the sound on a movieclip, should i delete the movie clip?
oh f***, i got it all wrong. i though A was a button:(
follow the advice of the guys above:)
follow vintage’s example:)