# 2 swfs, 2 classes (one for each), one loads the other, how to unload?

**URL:** <https://forum.kirupa.com/t/2-swfs-2-classes-one-for-each-one-loads-the-other-how-to-unload/296249>\
**Category:** flash\
**Created:** [September 11, 2009, 4:41pm UTC](https://forum.kirupa.com/t/2-swfs-2-classes-one-for-each-one-loads-the-other-how-to-unload/296249 "2009-09-11T16:41:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dragonfly](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dragonfly](https://forum.kirupa.com/u/dragonfly)\
**Post date:** [September 11, 2009, 4:41pm UTC](https://forum.kirupa.com/t/2-swfs-2-classes-one-for-each-one-loads-the-other-how-to-unload/296249/1 "2009-09-11T16:41:31Z")

</div>

I’m having just a pickle of a time with this.

SWF A loads SWF B with addChild. SWF B covers SWF A entirely.

Now I want to unload SWF B with a button in SWF B. The button in SWF B is programmed with SWF B’s class.

From SWF B’s class I’ve tried:

removeChild(this);

and:  
SWFClassA(parent).removeSWFB();

and, desperately:  
removeChildAt(numChildren-2);

I get “must be child of the caller” errors or “null object reference” when I try to do this. How can I do this right or differently?

Please help. Thanks.
