Be a Supporter!
Spawd
Spawd
  • Member since: Jun. 25, 2015
  • Offline.
Forum Stats
Supporter
Level 02
Artist
Sound keeps playing AS3 2017-04-22 02:38:47 Reply

I have a gun firing movieclip, with sound playing on its keyframes.

When the player presses 'A' the gun fires.

The problem is that when the player gets hit by an enemy and goes to the "Hit animation" keyframe, the gun sound keeps on playing.

CjElliott
CjElliott
  • Member since: Jun. 4, 2015
  • Offline.
Forum Stats
Supporter
Level 07
Game Developer
Response to Sound keeps playing AS3 2017-05-07 06:48:02 Reply

Well when it comes to sfx I would recommend using the sound class, however if you want to use keyframes you should just be able to click the first frame of your "get hit" animation, select the fire sound and tell it to stop, if its not playing its not going to cause and issues, if it is then it will stop.

Its not the best solution but should work.

Gimmick
Gimmick
  • Member since: Aug. 20, 2008
  • Offline.
Forum Stats
Member
Level 27
Programmer
Response to Sound keeps playing AS3 2017-05-07 06:57:20 Reply

At 4/22/17 02:38 AM, Spawd wrote: I have a gun firing movieclip, with sound playing on its keyframes.

When the player presses 'A' the gun fires.

The problem is that when the player gets hit by an enemy and goes to the "Hit animation" keyframe, the gun sound keeps on playing.

I assume you're using Flash Pro/Animate CC. Is the sound setting set to "Loop"? Alternatively, instead of the "Start" setting in the frame properties, change it to "stream". That way it'll only play once per loop.


Slint approves of me! | "This is Newgrounds.com, not Disney.com" - WadeFulp
"Sit look rub panda" - Alan Davies

BBS Signature