Jump to content
Search Community

i cannot figure out how to stop the video

Harvid test
Moderator Tag

Recommended Posts

i cannot figure out how to stop the video insight the loadet .swf

i have tryed to .empty(true) and removeChild.

but the video seems to be running in the background,and dragging my olde test computer down in graphic performance.

 

please help me. i almost can't take anymore code problems ;-)

Link to comment
Share on other sites

Your files couldn't be compiled without a bunch of errors in your code, but it sounds like you need to make sure you clean up your swf before unloading it. SWFLoader cannot know all of what's going on in your swf in terms of NetStreams, listeners, etc. so you should consider creating a dispose() method (or whatever you want to name it) that handles cleanup chores. In your example, that dispose() method would also call dispose() on your nested VideoLoader instance so that the video stops playing/loading. So in the parent, your code might look like:

 

homeloader.rawContent.dispose();
homeloader.dispose(true);

Link to comment
Share on other sites

when i add it to the loader sequins, it seems like it kill the loader max totaly.

What is the "loader sequins"?

 

Did you realize that when you dispose(true) a loader (or LoaderMax), it completely destroys it and you should never try to reuse it? It looks like your code disposes LoaderMax instances and then tries to append() loaders to them and reuse them. Don't do that :)

 

Can you please post a very specific question? I believe I already answered your question about the VideoLoader and the need to clean up after yourself in your swfs before you dispose() them. Right?

Link to comment
Share on other sites

My crestion is how do i clean up the loaders for videos,

the videos is loaded in whit loadermax inbetted insight .swf

i have tryed to .empty(true,true) and removeChild. so the dispose(true) was just another trat

 

  // CLEAN UP queuemeny2 FOR OLDE VIDEOS

  switcher = 1;
   queuemeny1.append( new SWFLoader("SWFS/MAIN/"+event.target.name+".swf", {name:"menymainClip1",onInit:initHandler, alpha:0, container:this, y:86, autoPlay:false}));
   queuemeny1.load();
trace("første")
   }
else
{
  // CLEAN UP queuemeny1 FOR OLDE VIDEOS

switcher = 0;
queuemeny2.append( new SWFLoader("SWFS/MAIN/"+event.target.name+".swf", {name:"menymainClip2",onInit:initHandler, alpha:0, container:this, y:86, autoPlay:false}));
   queuemeny2.load();
trace("anden")

Link to comment
Share on other sites

Your VideoLoader is nested inside of a subloaded swf, right? As I tried to explain, you must clean up after yourself in your sub-swfs. Since you didn't define requireWithRoot in that VideoLoader, it is impossible for the parent SWFLoader to discover that loader and clean up after it when you dispose() the parent SWFLoader. And even if it could, it is still considered a best practice to have a dispose() method in your swf where you clean up your own listeners, null object references, stop videos, etc. so that it can be properly disposed and garbage collected.

 

So like I said, you need to dispose() your VideoLoader. Do not assume that the parent SWFLoader will do it for you - it can't. So create a dispose() method yourself in your sub-swf. Inside that dispose() method, make sure you call your VideoLoader's dispose(true) method. Then you can dispose() the parent SWFLoader.

Link to comment
Share on other sites

I think i understand.

i have no idea how to duit,

the button ther stop the loadet video is in the main swf and the video is in a subloaded swf.

do you know wher i can find a example how to du it, Sorry i'm not good to coding, i am a designer

and this is the last thing before i can uploade my side.

Link to comment
Share on other sites

Ok now its working :D

 

just for the help of other beginners her is the code

 

subloaded swf

var video:VideoLoader = new VideoLoader("SWFS/videos/1.f4v", {name:"Contactvideo", repeat:-1, autoPlay:true, container:con1, width:1024, height:428, scaleMode:"proportionalInside", requireWithRoot:this.root});

video.load();

function destroy():void
{
video.dispose(true);
} 

 

main .swf

  var con1:ContentDisplay = LoaderMax.getContent("menymainClip1");
 con1.rawContent.destroy()

 

and thank you for explaining it for me

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...