Skip to main content
Inspiring
May 7, 2008
Question

Sound problems

  • May 7, 2008
  • 6 replies
  • 730 views
Ok i'm not sure how to put the .fla file on for you to see the problem but ill explain as best as possible.

Basically i press a button, a ball builds up, then it fires, but when it fires a nice catchy little "HADOKEN" is shouted. When i let go the sound stops. But.... i have to hold down spacebar for the ball to build up and fire. So when it gets to firing stage, as i fire the ball and hadoken is shouted, it is shouted many times because i have to hold down button, how do i get it to play the sound only once even with key held down, either explain or attach code.

Thanks very much in advance.

Here is my script: (Thanks Flashtastic for all your help)


This topic has been closed for replies.

6 replies

kglad
Community Expert
Community Expert
May 11, 2008
you're welcome.
Participating Frequently
May 12, 2008
Kglad is always so helpful and his patience is really inhuman! Lol. I don't know if you still remember, but you once helped me with around 15 replies. Lol. I'll always be grateful to ya :)
Inspiring
May 10, 2008
I'm getting the exact same result as before, something must be wrong here, how do i upload the .fla file ill show you the problem im recieving, and if possible maybe you could upload a version of my .fla that works. Sorry for all the fuss.

James
kglad
Community Expert
Community Expert
May 10, 2008
try:

Inspiring
May 11, 2008
Awesome works perfectly, and i understand why :) which is the most important thing. Thanks very much for remaining constantly helpful and not giving up, cos this was a real messed up job by me :S, once again thankyou.

James.
Inspiring
May 9, 2008
ok sorry this is quite embarrasing, i've looked around on tutorials and stuff for what you mean and ive tried entering in different things instead of (this), and im getting either the same result as before or no result at all. I think here i'm just gonna need someone to tell me what to put in instead (sorry) :(

Thanks

James
kglad
Community Expert
Community Expert
May 9, 2008
try:

kglad
Community Expert
Community Expert
May 8, 2008
change the "this" in your sound constructor to a timeline.
Inspiring
May 8, 2008
hmmmm.... i put it there before and it didn't work... and it still isn't working... :( i wont put my whole script again but this is part of it (im quick replying so it isnt attached):


if(bullet._xscale == 500){
firing = true;
hadouken = new Sound(this);
hadouken.attachSound("hadoken");
hadouken.start();
bullet.onEnterFrame = function(){
this._x += 50;
}
kglad
Community Expert
Community Expert
May 7, 2008
don't put your sound statments in an onEnterFrame loop.
Inspiring
May 8, 2008
ok i understand what your sayin, but where should i put it, im pretty new atflash, and i don't give up easily so believe me when i say i have tried (i hope). I put it as

if (firing){
hadouken = new Sound(this);
hadouken.attachSound("hadoken");
hadouken.start();
}

But nothing, i tried a few other places but nothing, advice or a code is fine :) thanks very much
kglad
Community Expert
Community Expert
May 8, 2008
in your onKeyDown function use: