Jump to content
Search Community

simple swf loading unloading

aaseb test
Moderator Tag

Recommended Posts

hello, i'm trying to load an external swf into a container but i cant seem to figure it out.

I tried :

 

import com.greensock.*;
import com.greensock.loading.*;
import com.greensock.events.LoaderEvent;
import com.greensock.loading.display.*;

var loader:SWFLoader = new SWFLoader("test.swf");
loader.load();
container.addChild(loader);

 

but it doesn't seem to work.

Once I figure out how to load it I would also like to unload it.

Any help would be very appreciated.

Link to comment
Share on other sites

ok i got one part

say my container is a movieclip called SWFcontainer, i now have this :

 

var loader:SWFLoader = new SWFLoader("test2.swf", {container:SWFcontainer});
loader.load();

 

that works but i still haven't figured out the unloading part.

Link to comment
Share on other sites

Yep, you have several options for adding the swf to a container. You already figured out one, but you could also do this:

 

container.addChild(loader.content);

 

As far as unloading the content, if you want to completely obliterate everything having to do with the loader (including the swf it loaded), simply call loader.dispose(true). If you just want to unload the content but keep the loader so that you can reload again later, use loader.unload().

 

Does that clear things up for you?

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