# Removing external swf from within the swf?

**URL:** <https://forum.kirupa.com/t/removing-external-swf-from-within-the-swf/257220>\
**Category:** flash\
**Created:** [April 11, 2008, 11:15am UTC](https://forum.kirupa.com/t/removing-external-swf-from-within-the-swf/257220 "2008-04-11T11:15:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![incubo80](https://avatars.discourse-cdn.com/v4/letter/i/8797f3/32.png) [@incubo80](https://forum.kirupa.com/u/incubo80)\
**Post date:** [April 11, 2008, 11:15am UTC](https://forum.kirupa.com/t/removing-external-swf-from-within-the-swf/257220/1 "2008-04-11T11:15:24Z")

</div>

Hi people, an AS newbie here with a simple question i hope is easy to answer!

I have two files. parent.fla contains a button that loads the external “child.swf” and child.fla contains a button that removes this very file – which never works, giving me the good old Error #1034: Type Coercion failed: cannot convert global@1cf60101 to flash.display.DisplayObject.at MethodInfo-4()

parent.fla:

```auto

var t:URLRequest=new URLRequest("child.swf");
var loader:Loader=new Loader();
AC_btn.addEventListener(
  MouseEvent.MOUSE_UP,
  function (evt:MouseEvent):void {
      loader.load(t);
        stage.addChild(loader);
  }
);

```

child.fla:

```auto

RC_btn.addEventListener(
  MouseEvent.MOUSE_UP,
  function(evt:MouseEvent):void {
[COLOR=Gray] //the following line is the crunch:[/COLOR]
    root.removeChild(this);
  }
);

```

I’ve tried parent, this.parent and about any other word i could think of, but methinks there is something wrong with the loader. Any suggestions would be hugely appreciated!
