Sound only plays once?

Hi all,

I have an animation that is on a sliding navigation bar. When the user mouses over the sliding nav it pops up and triggers the animation. The animation is of a subway train rolling in. I have some sound effects for the subway - one of air brakes as the train comes to a halt, and another for the train rolling out (another animation after the user presses a button). All sounds are defined at the root.

Here is the problem - the sound of the train rolling out, which is triggered when the user hits a button and the train --> out animation is triggered, works fine every time. The sound of the train coming to a stop works fine the first time but that’s it.

Here is the code I am using for the sliding nav, which is on the main timeline and was written by Voetsjoeba; it also contains the call for the first sound:


trainStop = new Sound();
trainStop.attachSound("airbrake");
this.onEnterFrame = function() {
	if (slidingNav.hitTest(_xmouse, _ymouse)) {
		_root.slidingNav.trainIn.gotoAndPlay(2);
		if (playing != true) {
			_root.trainStop.start(0, 0);
			playing = true;
		}
		delete this.onEnterFrame;
	}
};

Any ideas why it won’t work after the first time?


 _root.trainStop.start(0, 0);

the second number tell flash how many times to loop the audio


 _root.trainStop.start(0, 99);//loops 99 times

:slight_smile:

Yeah, thanks, I had that figured out. :bu:

I didn’t really want the sound to loop - just play every time the animation was triggered, which was done using a hit test.

Anyway, I figured it out - I had to remove the AS from the sliding nav and put it on the animation itself. Works great now!

:thumb:

sorry i only read part of your post, glad it works