# Cannot access a property or method of a null object reference

**URL:** <https://forum.kirupa.com/t/cannot-access-a-property-or-method-of-a-null-object-reference/278622>\
**Category:** Uncategorized\
**Created:** [January 2, 2009, 8:03pm UTC](https://forum.kirupa.com/t/cannot-access-a-property-or-method-of-a-null-object-reference/278622 "2009-01-02T20:03:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wiserd](https://avatars.discourse-cdn.com/v4/letter/w/57b2e6/32.png) [@wiserd](https://forum.kirupa.com/u/wiserd)\
**Post date:** [January 2, 2009, 8:03pm UTC](https://forum.kirupa.com/t/cannot-access-a-property-or-method-of-a-null-object-reference/278622/1 "2009-01-02T20:03:28Z")

</div>

I get the error:

Cannot access a property or method of a null object reference.

when I uncomment   
[//targetArray.push](https://targetArray.push)(target2);

```
stop();
var targetArray:Array;
var target2:Target= new Target("eggs", 5);//:Target = new Target("ribbon", 9);
//targetArray.push(target2);

```

target2.x=90;  
target2.y=90;  
addChild(target2);

Can’t I create an array of instances?
