R – Audio of a specific video swf doesn’t stop when I load another URLRequest

actionscript-3flashvideo

I am trying to stop the audio of the video swf and I can't get it to stop. Here is my code for loading the file:

var myLoader:Loader= new Loader();
myLoader.x=420;
myLoader.y=200;
// boolean variable set for use below in our function
var screenCheck:Boolean = false;
//These three linces keep stafe elements the same size, so they don't distort
var swfStage:Stage = this.stage;

video_btn.addEventListener(MouseEvent.CLICK,contentvideo);

function contentvideo (event:MouseEvent):void{
            myLoader.load(new URLRequest("prevideo.swf"));
            addChild(myLoader);
            movie_btn.stop();
            movie_btn.visible=false;
                             }

Now I have other functions that load different URLRequest and when they are loading, the audio keeps playing. Do I have to add a line of code to them? I also have an MP3 player and tried SoundMixer.stopAll(). I still need the mp3 player to keep playing.

Best Answer

I'm not familiar with what you're doing but just looking at the code and given the problem you're experiencing I wonder if that

addChild(myLoader); 

has anything to do with it. It seems like the kind of thing that could easily create multiple child objects which is why you continue to experience the sound play back. Is there a removeChild[0] option or something?

A shot in the dark I know but I thought I'd offer the possibility anyway.

Related Topic