TypeError: Error #1009: Cannot access a property or method of a null object reference. Class references maybe?
===

I get this error when I run my code:

TypeError: Error #1009: Cannot access a property or method of a null object reference. at scripts::Enemy/moveToward()

I'm assuming it has something to do with registering he player on the stage. I have 3 classes so far: Engine, Player and Enemy. I'm am currently building a sidescrolling beat em up game.

    package scripts 
    {
        import flash.display.*;
        import flash.events.*;
        import flash.events.Event;
        import flash.display.Stage;
    
        public class Enemy extends MovieClip
        {
            var enemySpeed: Number = 3;
            var xDistance: Number = 50
            var yDistance: Number = 20;
    
            public var player: Player;
    
                    public function Enemy()
                    {
                            this.addEventListener(Event.ADDED_TO_STAGE, addListeners)
                    }
    
            public function addListeners(event: Event):void
            {
                stage.addEventListener(Event.ENTER_FRAME, moveToward);
                trace("handeled");
            }
    
            function moveToward(event: Event):void
            {
                if(this.x < player.x - xDistance)
                {
                    this.x += enemySpeed;
                    this.scaleX = -1;
                }
                if(this(root).x > player.x+xDistance)
                {
                    this.x -= enemySpeed;
                    this. scaleX = 1;
                }
    
                if(this.y < player.y-yDistance)
                {
                    this.y += enemySpeed;
                }
                if(this.y > player.y+yDistance)
                {
                    this.y -= enemySpeed;
                }
            }