views:

997

answers:

5

I have a Flash piece that has one main timeline that loads different movie clips and different sections of that main timeline.

On those embedded movie clips within the main timeline are sounds attached to the embedded movieclips timelines set to "stream". They have to be on the timeline so they sync up correctly (I can't load the sounds programatically).

I'm having the issue that when I navigate to a new section on the main timeline, the movieclip that was embedded on the timeline I navigated away from goes away, but the sound continues to play. I can't figure out how to get the sound to stop once I've navigated away.

I can't add a stop all sounds because the navigation of the movie is controlled from an external player I don't have control over (basically the external player just calls a gotoAndStop("myFrame") on the movie.).

Any ideas why the timeline sounds isn't working like it's suppose to?

Thanks.

A: 

One thing you can do is to have an object that manages all sounds(ex: a SoundManager class). It knows all the sounds that are playing. When you go to a new section of your movie, the first thing you may want to do is to ask the SoundManager to stop all sounds.

milesmeow
+3  A: 

Two possible solutions:

1. This should stop all sounds currently playing. May not work for you if you need stuff like background music to continue playing after you transition out. It's a workaround.

import flash.media.SoundMixer;

SoundMixer.stopAll()

2. Do this on the MovieClip that has sounds you want to get rid of:

var myMovieClip:MovieClip;

var muteTransform:SoundTransform = new SoundTransform();
muteTransform.volume = 0;
myMovieClip.soundTransform = muteTransform;

Timeline sounds in Flash are a pain! It's buggy and Adobe should fix it, but they probably won't.

simplychaos
That might actually work, but at that point in the timeline, the movie doesn't exist anymore so I can't address it.The stopAllSounds won't work due to the nature with which the timeline has to be built. Thanks for the suggestions though.
Ryan Smith
I work at an animation studio, and folks run into this problem all the time. The usual solution is to create a new timeline layer with a frame of streaming sound underneath (or above?) the layer which is isn't stopping right. This extra layer of sound should use a silent audio clip, which might have to be the duration of the timeline and not just a looping thing. They call it a 'dead sound' track. I haven't verified this to work. But, I also can't get the solution provided here to work for me, either :/
Pup
A: 

Hello i have the same problem and it doesnt work... The sound from the old movie clip replay each time i navigate to main timeline...

herve
A: 

make a global variable file myglobal.as, in that file define package { public class MyGlobal { public static var cycle:int; } }

and use import myglobal on frame 1 of the main timeline.

myglobal.count +=1; fist thing u do on frame 1.

if(myglobal.count==1){ sound.play(); };

END that should work to only play it once.

cody godines
A: 

Break your timeline animation up into separate MovieClips.

Pup