# TypeError: Error #1009

**URL:** <https://forum.kirupa.com/t/typeerror-error-1009/322904>\
**Category:** Uncategorized\
**Created:** [June 8, 2011, 9:12am UTC](https://forum.kirupa.com/t/typeerror-error-1009/322904 "2011-06-08T09:12:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![12abhi12](https://avatars.discourse-cdn.com/v4/letter/1/9f8e36/32.png) [@12abhi12](https://forum.kirupa.com/u/12abhi12)\
**Post date:** [June 8, 2011, 9:12am UTC](https://forum.kirupa.com/t/typeerror-error-1009/322904/1 "2011-06-08T09:12:36Z")

</div>

TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at com.as3::enemyslime/frame23()

I got this error when I wrote the line

```
		enemy_no.gotoAndStop(Math.ceil(Math.random()*3))

```

enemy\_no is an instance of the object enemy slime. The mc has 25 frames with the last frame having the code to remove the mc on being played.

EDIT: I solved the problem by adding a stop in the first frame of the mc.

Why was this happening?
