# Error when removing child

**URL:** <https://forum.kirupa.com/t/error-when-removing-child/271034>\
**Category:** Uncategorized\
**Created:** [September 17, 2008, 5:06pm UTC](https://forum.kirupa.com/t/error-when-removing-child/271034 "2008-09-17T17:06:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![HMPoweredMan](https://avatars.discourse-cdn.com/v4/letter/h/57b2e6/32.png) [@HMPoweredMan](https://forum.kirupa.com/u/HMPoweredMan)\
**Post date:** [September 17, 2008, 5:06pm UTC](https://forum.kirupa.com/t/error-when-removing-child/271034/1 "2008-09-17T17:06:03Z")

</div>

Hi guys. I am new here and thought I’d introduce myself with a problem

I get this error

```auto

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at shot/eFrame()

```

From this code.

```auto
          
private function eFrame(event:Event):void{
   this.x += 6
     if (this.x > 240) {
         this.parent.removeChild(this);
         this.removeEventListener(Event.ENTER_FRAME, eFrame)
}

```

It is an enter from function on a class called shot. It kills itself when it gets off the screen. Now the error doesn’t occur for every shot. It seems to be random which ones actually get the error. I don’t know what the problem is.
