Skip to main content
Daniel Gimness
Inspiring
September 24, 2010
Answered

loaded swf telling parent swf to unload itself?

  • September 24, 2010
  • 2 replies
  • 1110 views

Hi,

I'm stuck. Anyone please help...

I have a shell swf that is loading a swf. How do you have the loaded swf tell the parent loader to unload itself after the loaded swf finishes playing?

Thanks,

Dan

This topic has been closed for replies.
Correct answer Ned Murphy

Try using: MovieClip(parent.parent).unloadSwf();

2 replies

September 24, 2010

You can just have a function on the shell swf that unloads the child. Then you call this from the loaded movie. For example:

On the parent:

public function unloadSwf():void {

     removeChild(yourLoadedSwf);

}

On the child:

parent.parent.unloadSwf();

Daniel Gimness
Inspiring
September 25, 2010

Thanks for the reply, though with AS3, it throws an error for just about everything it seems!

When I inserted this code:

parent.parent.unloadSwf();

on the timeline of the swf that is loaded in the parent, this is the error message I received when publishing the swf that is to be loaded:

Scene 1, Layer 'Layer 1', Frame 61, Line 1 1061: Call to a possibly undefined method unloadSwf through a reference with static type flash.display:DisplayObjectContainer.

Any idea what this means?

Thanks,

Dan

Ned Murphy
Ned MurphyCorrect answer
Legend
September 25, 2010

Try using: MovieClip(parent.parent).unloadSwf();

Inspiring
September 24, 2010

Dispatch event and listen to it in the loading (parent) swf.