Sounds overlapping

if I have two button driven sound events. How do I keep the sound from overlapping? I want the first one to stop and the next one to begin.

I did try the sound.stop() with the newsound constructor, but it’s acting weird.

Any thoughts?

Two possibilities -

One is to add the linkage ID name to the stop command -

mySound.stop(“IDNameHere”)

Or, and probably best, assign each sound to its own unique mc - like an empty clip, as in:

MySoundObject=new Sound(MCNameHere); //no quotes

MySoundObject.attachSound(“IDNameHere”);

I’ve got my sound object tutorial up and running at:

http://www.kennybellew.com

There are more examples there.

Hi,

Have u attached the sounds to movieclips?

I had that problem and solved it by doing that.

Use something like this:

aSound = new Sound(aSoundContainer);
bSound = new Sound(bSoundContainer);

where aSoundContainer and bSoundContainer are movieclips to which u attach the sounds like:

aSound.attachSound(“soundfry”);
bSound.attachSound(“soundboil”);

soundfry and soundboil are the linkage ID names of the sounds.

Cya

Sho

Sorry,

where aSoundContainer and bSoundContainer are INSTANCE NAMES of movieclips to which u attach the sounds like:

Sho

If in doubt, put a stopAllSounds(); command in there somewhere, to stop everything before playing another. Providing this option still exists in MX of course…

thanks, fellers… ehheeh

I had tried the methods you described, except for the attachsound. I’ll give it a shot.

Thanks, Compadres!!

It is amazing that I had not run into that problem before… Isn’t it?