Flash memory does not stop when navigating

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

In those built-in video clips on the main timeline, sounds are attached to the built-in time frames of movie clips set to “stream”. They must be on the timeline so that they synchronize correctly (I cannot download sounds programmatically).

I had a problem: when I move to a new section on the main timeline, the movie clip that was built into the timeline from which I was moving leaves, but the sound continues to play. I can’t figure out how to stop the sound as soon as I leave.

I can’t add to stop all sounds because the control of the movie is controlled from an external player on which I have no control (basically the external player just calls gotoAndStop ("myFrame") in the movie.).

Any ideas why the sounds of the timeline do not work as intended?

Thanks.

+3
source share
9 answers

Two possible solutions:

1. This should stop all sounds currently being played. May not work for you if you need things like background music to keep playing after the transition. This is a workaround.

import flash.media.SoundMixer;

SoundMixer.stopAll()

2. Do it in MovieClip, which has the sounds you want to get rid of:

var myMovieClip:MovieClip;

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

Flash - ! , Adobe , , , .

+6

AS3 SWF, 1 ( 2 ) ...

+1

, , - , (: SoundManager). , . , , , SoundManager .

0

myglobal.as,

package {
  public class MyGlobal {
    public static var cycle:int;
  }
}

myglobal 1 .

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

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

END, .

0

.

0

:

public function stopAllMovies(mov:MovieClip, mute:Boolean=false):void{
    //trace("STOPING MOVIE "+mov);
    mov.stop();
    if(mute) {
        var muteTransform:SoundTransform = new SoundTransform(0.0);
        mov.soundTransform = muteTransform;
    }
    for (var i:uint=0;i<mov.numChildren;i++){
        var m = mov.getChildAt(i);
        if(m is MovieClip){
            if(mute) m.soundTransform = muteTransform;
            m.stop();
            stopAllMovies(m);
        }
    }
}
0

, , - , ( , ). , , , ...

: , , : mc_1 ( ), mc_2 - , .

mc_1,

mc_1.gotoAndStop("frameWhereAudioEnds");

-.

mc_2.play();
0

I would try listening to the removedFromStage event on a movie clip that leaves (I suppose there is no instance of this movie clip in the timeline at the point you are moving to), and then use MovieClip.SoundTransform as above.

0
source

SoundMixer.soundTransform = new SoundTransform (1, 0); // panning volume

0
source

Source: https://habr.com/ru/post/1725878/


All Articles