Flash Hates Me. Error #1009: Cannot access a property or method of a null object reference

Posted by sol on Stack Overflow See other posts from Stack Overflow or by sol
Published on 2009-09-09T04:49:05Z Indexed on 2010/05/29 6:02 UTC
Read the original article Hit count: 286

Filed under:
|
|

I simply create a movie clip, put it on the stage and give it an instance name of char.

Here's my document class, simple as can be:

   public class Test extends MovieClip
        {

        	public function Test() 
        	{
        		char.x = 1315; char.y = 459;
                addEventListener(Event.ENTER_FRAME, mouseListen);

        	}

            private function mouseListen(e:Event) {
    		    char.x = mouseX;
    		    char.y = mouseY;
    	    }	

        }

And I get this error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.me::Test/::mouseListen()

How in the world is it possible that it knows what "char" is in the constructor but not in the mouseListen function? What else could it be?

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript-3