How do I make my money object Make a sound when I pick it up? I got the scoring and everything good, I just need my money to make a sound when I pick it up, How would I do this?
I am in flash 8 please help me.
Printable View
How do I make my money object Make a sound when I pick it up? I got the scoring and everything good, I just need my money to make a sound when I pick it up, How would I do this?
I am in flash 8 please help me.
What's the code for picking up money? If it's something like this:
Actionscript Code:onClipEvent(enterFrame){
if(this.hitTest(_root.player)){
unloadMovie(this);
}
}
then import your sound file into Flash, in the Library, find it there (CTRL+L), right-click it, press Linkage, in the Identifier field, type in, coinSound, and press OK. Use this code after, unloadMovie(this); :
Actionscript Code:sound = new Sound();
sound.attachSound("coinSound");
sound.start(0, 1);
making the whole code look something like this:
Actionscript Code:onClipEvent(enterFrame){
if(this.hitTest(_root.player)){
unloadMovie(this);
sound = new Sound();
sound.attachSound("coinSound");
sound.start(0, 1);
}
}
and btw, always include codes you use in your posts, otherwise people won't be able to help you, because there are multiple ways of coding one thing, and it varies from programmer to programmer
That's almost the same as the one I anticipated, so you should be able to modify it by yourself, but if not, then here you go:
Actionscript Code:onClipEvent(enterFrame){
if(_root.char.hitTest(this)){
_root.money += 10;
unloadMovie(this);
sound = new Sound();
sound.attachSound("coinSound");
sound.start(0, 1);
}
}
then follow what I said in my previous post about linking a new sound from the Library