# Is there anyway to remove a "gone" child?

**URL:** <https://forum.kirupa.com/t/is-there-anyway-to-remove-a-gone-child/284827>\
**Category:** flash\
**Created:** [March 24, 2009, 7:01am UTC](https://forum.kirupa.com/t/is-there-anyway-to-remove-a-gone-child/284827 "2009-03-24T07:01:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhangxiaorui](https://avatars.discourse-cdn.com/v4/letter/z/e495f1/32.png) [@zhangxiaorui](https://forum.kirupa.com/u/zhangxiaorui)\
**Post date:** [March 24, 2009, 7:01am UTC](https://forum.kirupa.com/t/is-there-anyway-to-remove-a-gone-child/284827/1 "2009-03-24T07:01:04Z")

</div>

Is there anyway to remove a “gone” child? I mean, after using “addChild” to add some stuff to the stage and change the reference afterwards.

See the code below, shapeA is gone, so there is no way to find it back?

```auto
package {
  import flash.display.Shape;
  import flash.display.Sprite;

  public class DummyProject extends Sprite
  {
    private var shapeA:Shape;
    private var shapeB:Shape;
    public function DummyProject()
    {
      shapeA = new Shape();
      shapeB = new Shape();
      shapeA.graphics.beginFill(0,1);
      shapeA.graphics.drawRect(20,20,20,20);
      shapeA.graphics.endFill();
      shapeB.graphics.beginFill(0,.5);
      shapeB.graphics.drawRect(20,40,20,20);
      shapeB.graphics.endFill();
      shapeA.name = "a";
      shapeB.name = "b";
      addChild(shapeA);
      addChild(shapeB);
      shapeB = shapeA;
      trace(shapeB.name);
      shapeB.x = 40;
      addChild(shapeB);
      removeChild(shapeB);
      [COLOR="Red"]removeChild(shapeA);// This is not working since shapeA is already removed after shapeB = shapeA and removeChild(shapeB)[/COLOR]
    }
  }
}

```
