Calling a class function within another class

Hi.
I’ve been searching around the forums to find a solution of this problem.
I have two classes: Monster and Player. Constructors are defined and the classes by themselves apparently works.
My problem is that I want to get player.x inside the Monster class.

So I want to be able to do this:

inside a function of the monster:

{…
pan = this.x - player.getX();
…}

inside the player class:

public function getX():Number{
return this.x;
}

Within my .fla file i create two instances:

// do not mind the “localhost”, 31337 part.
var player: Player = new Player(“localhost”, 31337);
addChild(player);
var monster:Monster = new Monster(“localhost”, 31339);
addChild(monster);

trace(player.getX()); // works

when compiled i get:
1120: Access of undefined property player.

thanks in advance.
/Lasse