Jump to content
Search Community

remove external swf

chefkeifer test
Moderator Tag

Recommended Posts

I am having an issue trying to get video that is playing from an external swf to stop when you go to another page. i have read and read and looked and looked for tutorials and nothing seems to be what i am looking for. isnt somewhere i can add the removeChild(contentLoader) within my tweenmax varaible to make this video quit playing

 

 

here is my code

var contentLoader:Loader = new Loader();
contentLoader.contentLoaderInfo.addEventListener("progress", looping);
contentLoader.contentLoaderInfo.addEventListener("complete", fadeIn);
//*****====================================================*****
var swf:MovieClip;
var destX:Number = 0;
var destY:Number = 300;
loadMC.visible = false;
//*****====================================================*****
var defaultSWF:URLRequest = new URLRequest("fr_palmetto.swf");
//*****====================================================*****
contentLoader.load(defaultSWF);
addChild(contentLoader);
var contentIn:TimelineMax = new TimelineMax();
contentIn.append(TweenMax.to(contentLoader, 1, {x:destX, y:destY, alpha:1}));
//*****====================================================***** 

function looping(e:ProgressEvent):void {
	loadMC.visible = true;
       var perc:Number = Math.round((e.bytesLoaded / e.bytesTotal) * 100);
       loadMC.txtPercent.text = perc + "%";
	}
function clicked(event:MouseEvent):void{
       transLoad(event.target.name + ".swf");
}
function transLoad(url:String):void{
       if(contentLoader.content){
		var out:TimelineMax = new TimelineMax();
               out.insert(TweenMax.to(contentLoader, .75, {alpha:0, onComplete:transIn,
								   onCompleteParams: [url])}));


       } else {
               transIn(url);
       }
	}

function transIn(url:String):void{
	addChild(contentLoader);
       contentLoader.load(new URLRequest(url));
	}
function fadeIn(event:Event):void{
	loadMC.visible = false;
       var fader:TimelineMax = new TimelineMax();
		fader.append(TweenMax.to(contentLoader,  0, {alpha:0}));
		fader.append(TweenMax.to(contentLoader,  0, {x:0, y:300}));
       	fader.insert(TweenMax.to(contentLoader,  2, {alpha:1}));
		fader.insert(TweenMax.to(contentLoader,.75, {x:destX, y:destY}));

	}
//*****====================================================*****

Link to comment
Share on other sites

Why aren't you using LoaderMax? :)

 

Anyway, you need to handle that in your child swf - NetStreams don't automatically just stop playing when you remove a DisplayObject from the stage. You must specifically pause() and close() the NetStream. Or stop the FLVPlayback or whatever you're using in that child swf.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...