ForumsProgramming ForumAs3 #1009 outPut TypeError~~ Please Help!

1 3310
alsage
offline
alsage
132 posts
Nomad

It says this:

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


I know whats causing the problem but I need that line of code for the game to work..
Code:
stage.addEventListener(Event.ENTER_FRAME, CursorColideWithMap );
function CursorColideWithMap(event:Event):void{

if(FinishLine.hitTestPoint(cursor.x, cursor.y, true)){
stage.removeEventListener(Event.ENTER_FRAME, CursorColideWithMap );
gotoAndStop(3);
}
if(Level1.hitTestPoint(cursor.x, cursor.y, true)){
stage.removeEventListener(Event.ENTER_FRAME, CursorColideWithMap );
gotoAndStop(2);
}
}


The Code that is causing it is this:
if(FinishLine.hitTestPoint(cursor.x, cursor.y, true)){
stage.removeEventListener(Event.ENTER_FRAME, CursorColideWithMap );
gotoAndStop(3);
}


It works fine when I take it out...Altho Even when it is still in it does excactly what its supposed to do it just throws an output error for no reason.

Please help
Thanks
~Sage
  • 1 Reply
Showing 1-0 of 1