# removeChild Problem

**URL:** https://forum.kirupa.com/t/removechild-problem/305110
**Category:** Uncategorized
**Created:** [February 19, 2010, 9:14am UTC](https://forum.kirupa.com/t/removechild-problem/305110 "2010-02-19T09:14:48Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Zen08](https://avatars.discourse-cdn.com/v4/letter/z/6de8d8/32.png) [@Zen08](https://forum.kirupa.com/u/Zen08)
#### Post date: [February 19, 2010, 9:14am UTC](https://forum.kirupa.com/t/removechild-problem/305110/1 "2010-02-19T09:14:48Z")

</div>

Hi guys!

So i have this problem that is bugging me a little bit and hopefully, someone could help.

Here’s the code:

```auto

package
{
    import flash.events.Event;
    import flash.display.*;
    import flash.events.*;
    import flash.utils.*;
        
    public class ShapeOuts extends MovieClip
    {
        public function grow():void
        {
            var container:empty = new empty();
            var myShape1;
            
            container.x = 240;
            container.y = 64;
            
            addChild(container);

            if(container.contains(myShape1))
            {
                container.removeChild(myShape1);
            }
            
            if(root && Object(parent).ShapeDetect == 1)
            {
                myShape1 = new Shape1L();
                container.addChild(myShape1);
            }
            if(root && Object(parent).ShapeDetect == 2)
            {
                myShape1 = new Shape2L();
                container.addChild(myShape1);
            }
            if(root && Object(parent).ShapeDetect == 3)
            {
                myShape1 = new Shape3L();
                container.addChild(myShape1)
            }
        }
    }
}

```

what i want here is that if there is an existing child in my container, i want it to be removed. Problem is, im getting this error.  
TypeError: Error #2007: Parameter child must be non-null.

Is there any solution to solve this problem?  
Thanks in advance
