Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
RapaNui

Call .unload from child swf??

Recommended Posts

Hi,

 

Quick question as I'm a bit of a noob to LoaderMax.

 

I'm creating SWF files with custom content and loading them using LoaderMax. It's all working great. However, my external swf's are like "windows" with their own close buttons. In the past I've used:

 

Movieclip(this.parent).unLoadContent();

 

This, however, does not work using LoaderMax. Is it possible to call unload from the loaded SWF (child)?

 

Any help would be greatly appreciated.

 

Many thanks,

 

J.

Link to comment
Share on other sites

I think I got it...

 

private function unloadMe(evt:MouseEvent){
  var curParent:DisplayObjectContainer = this.parent.parent;
  Object(curParent).unloadContent();
 }

 

this.parent.parent gets me back to the DocumentClass where I can call unload after doing a couple of tweens :)

Link to comment
Share on other sites

Yep, good job. Keep in mind that your content is wrapped in a ContentDisplay object (just a Sprite with some extra functionality) which is why you had to do parent.parent.

Link to comment
Share on other sites

Awesome, thanks for the quick response (and the reassurance!)

 

I'm now trying to pass an identifier from the child which calls out the loader from which the call came. Ideally it would mean this function will work in the DocumentClass...

 

 private function actuallyUnload(loaderToUnload:Object){
  loaderToUnload.unload();
  loaderToUnload.dispose(true);
  loaderToUnload=null;
 }

 

... however it seems I can't access the unload() function because it's not on that ContentDisplay Object. I'll keep plugging away but any assistance would be great.

 

Thanks again.

Link to comment
Share on other sites

The ContentDisplay has a "loader" property which you can tap into.

 

loaderToUnload.loader.dispose(true);

 

That'll do (no need to call unload() first because dispose(true) does that plus more).

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