# Custom Cursor

**URL:** <https://forum.kirupa.com/t/custom-cursor/320837>\
**Category:** Uncategorized\
**Created:** [April 3, 2011, 12:19am UTC](https://forum.kirupa.com/t/custom-cursor/320837 "2011-04-03T00:19:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Macca26](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@Macca26](https://forum.kirupa.com/u/Macca26)\
**Post date:** [April 3, 2011, 12:19am UTC](https://forum.kirupa.com/t/custom-cursor/320837/1 "2011-04-03T00:19:46Z")

</div>

hi,  
Ive got a crosshair cursor as part of my game, its loaded in on frame 4 which is where you shoot the targets. It all works fine, then wen i go to the next frame which is the scoreboard it goes back to the pointer fine. But in the output field in getting the following error:

TypeError: Error #1009: Cannot access a property or method of a null object reference. at TargetPractise\_fla::MainTimeline/redrawCursor( [TargetPractise\_fla.MainTimeline::frame4:7]

My code for the cursor is:

stage.addEventListener(MouseEvent.MOUSE\_MOVE, redrawCursor);  
stage.addEventListener(Event.MOUSE\_LEAVE, hideCursor);  
Mouse.hide();

function redrawCursor(event:MouseEvent):void  
{  
crosshair.visible = true;  
crosshair.x = event.stageX;  
crosshair.y = event.stageY;  
}

function hideCursor(event:Event):void  
{  
crosshair.visible = false;  
}

Thanks in advance

EDIT: Ive got the code for the cursor added in the actions for the frame that it on, if that makes any difference.
