# TypeError: Error #1009: Cannot access a property or method of a null object reference

**URL:** <https://forum.kirupa.com/t/typeerror-error-1009-cannot-access-a-property-or-method-of-a-null-object-reference/289030>\
**Category:** Uncategorized\
**Created:** [May 25, 2009, 10:42am UTC](https://forum.kirupa.com/t/typeerror-error-1009-cannot-access-a-property-or-method-of-a-null-object-reference/289030 "2009-05-25T10:42:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vidiveni](https://avatars.discourse-cdn.com/v4/letter/v/41988e/32.png) [@vidiveni](https://forum.kirupa.com/u/vidiveni)\
**Post date:** [May 25, 2009, 10:42am UTC](https://forum.kirupa.com/t/typeerror-error-1009-cannot-access-a-property-or-method-of-a-null-object-reference/289030/1 "2009-05-25T10:42:02Z")

</div>

Hi,

Anyone got an ideas why I get this following error message please.

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

Code as below.

package {  
import flash.display.MovieClip;  
import flash.events.Event;

```
public class Particle extends MovieClip {
	var xVel:Number;
	var yVel:Number;
	

	function Particle() {
		xVel=Math.random()*20-10;
		yVel=Math.random()*20-10;
		this.addEventListener(Event.ENTER_FRAME, update);
	}

	private function update(e:Event):void {
		
		this.y+=yVel;
		this.x+=xVel;
		
		
		if (this.x &gt; stage.stageWidth)
		{
			removeEventListener(Event.ENTER_FRAME, update);
			parent.removeChild(this);
		}
		
		if (this.y &gt; stage.stageHeight)
		{
			removeEventListener(Event.ENTER_FRAME, update);
			parent.removeChild(this);
		}
		
		
	}
}

```

}
