Hey everyone…
I’m new to OOP with Actionscript, and i guess i understand the basics, but the following costed me half the day and i still don’t understand it:
I have two classes, Node.as and Player.as.
I have this public function in my Node class:
public function getName():String {
return nodeName;
}
Now in the constructor of my Player class, i want to access this function:
public function Player(startNode:Node) {
trace ("node: " + startNode.getName());
}
The interesting part of my main actionscript:
var q:Node = new Node("q", 150, 225);
var player:Player = new Player(q);
My constructor always traces “node: undefined”.
So did i make a stupid mistake somewhere or is it just not possible to use classes in this way?