-
sound!
hi there,
i'm trying to add sound to my game - when a coin is collected i need a it to make a sound.
this is the actionscript i have used
Code:
onClipEvent (enterFrame) {
if (this.hitTest(_root.fish)) {
_root.score.text += 1;
unloadMovie(this);
}
}
thanks!
claire
-
var snd = new Sound();
snd.attachSound("coin_get.mp3");
_root.snd.start(0,0);
You need to export the sound for actionScript.
Also, it would be a better idea to use arrays and put all of your code on the main timeline.
-
President
The way Adam says is the way to go, but I think you should get rid of the "_root" in _root.snd.start(0,0), because you're declaring the variable locally. So applying it to your code it may be something like this:
Code:
onClipEvent(load) {
var snd = new Sound();
}
onClipEvent (enterFrame) {
if (this.hitTest(_root.fish)) {
snd.attachSound("coinSound");
snd.start();
_root.score.text += 1;
unloadMovie(this);
}
}
This is MC. His _parents sent him to stop() by the super market to buy some _root beer if he wanted to gotoAndPlay() with his friends at the park later.
This is my Blog!... The gaming Process
Please check out my site: Giddel Creations
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
|