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

**URL:** <https://forum.kirupa.com/t/error-1009-cannot-access-a-property-or-method-of-a-null-object-reference-presscheck/305021>\
**Category:** flash\
**Created:** [February 18, 2010, 3:28am UTC](https://forum.kirupa.com/t/error-1009-cannot-access-a-property-or-method-of-a-null-object-reference-presscheck/305021 "2010-02-18T03:28:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakmagi](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@jakmagi](https://forum.kirupa.com/u/jakmagi)\
**Post date:** [February 18, 2010, 3:28am UTC](https://forum.kirupa.com/t/error-1009-cannot-access-a-property-or-method-of-a-null-object-reference-presscheck/305021/1 "2010-02-18T03:28:06Z")

</div>

## Hullo… A newbie here…and AS3… Anyways…I was trying out AS3…when got this kinda error…

## TypeError: Error #1009: Cannot access a property or method of a null object reference. at testCollision1\_fla::MainTimeline/presscheck()

Anyways,…I created 2 sets of actions in 2 separate keyframes.  
I just wanted to try playing in between the different frames…plus a few basic mouse-button interactions.

## here’s a look at the first actionscript…/.

stop();  
moveblock.addEventListener(MouseEvent.MOUSE\_DOWN, startMove);  
stage.addEventListener (Event.ENTER\_FRAME, presscheck);  
toKeyz.addEventListener(MouseEvent.MOUSE\_UP, toNextKey);

function presscheck(event:Event):void  
{  
if(moveblock.hitTestPoint(mouseX, mouseY, true))  
{  
//trace(“they”);  
checkTxt.text = "Help: " + “them”;  
}  
}

function startMove(evt:MouseEvent):void  
{  
moveblock.startDrag();  
}

function toNextKey(evt:MouseEvent):void  
{  
gotoAndPlay(“keybord”);  
}

moveblock.addEventListener(MouseEvent.MOUSE\_UP, stopMove);

function stopMove(evt:MouseEvent):void  
{  
moveblock.stopDrag();  
checkTxt.text = “Help: block noticed”;  
if (bgwk.hitTestObject(moveblock))  
{  
trace(“hrthr”);  
[//moveblock.x](https://moveblock.x) = bgwk.x;  
[//moveblock.y](https://moveblock.y) = bgwk.y;  
//rectangle

```
}

```

## }

## …and here’s the second action frame

stop();

btninviz.addEventListener(MouseEvent.MOUSE\_UP, hidemouse);  
btnvizy.addEventListener(MouseEvent.MOUSE\_UP, showmouse);  
[//stage.addEventListener](https://stage.addEventListener)(Event.ENTER\_FRAME, keepcsr);  
toMose…addEventListener(MouseEvent.MOUSE\_UP, back21);

function hidemouse(evt:MouseEvent):void  
{  
Mouse.hide();  
}

function showmouse(evt:MouseEvent):void  
{  
Mouse.show();  
}

function keepcsr(evt:Event):void  
{  
newcsr.x = mouseX;  
newcsr.y = mouseY;  
}

function back21 (evt:MouseEvent):void  
{  
gotoAndPlay(“mousse”);  
}

* * *

## here’s me attached fla file… [http://www.mediafire.com/?nmzrxynzkfw](http://www.mediafire.com/?nmzrxynzkfw)

did skim through a few forums in this Error #1009 problem…am still confused…the only thing I noticed is that the error occurs when i add in the presscheck() and keepcsr() functions…which I suspect that it’s related (I might have wrongly called/declared them) in the:

‘stage.addEventListener(Event.ENTER\_FRAME, keepcsr);’, and  
‘stage.addEventListener(Event.ENTER\_FRAME, presscheck);’ lines…

Any ideas/suggestions to rectify them?
