I have a class that looks like this.
public class Man extends MovieClip
{
var typeOfPerson:String;
public function Man()
{
trace("In Man class:- ",typeOfPerson); //null
}
}
and another class like this
public class Wally extends Man
{
public function Wally()
{
typeOfPerson = "Nice guy, bit of a wally";
trace("In Wally class:-", typeOfPerson); //Nice guy, bit of a wally
}
}
I want to access the typeOfPerson variable from the Man class. When I view the output of the trace statements, the trace from the man class is displayed first. It is null, which makes sense because I haven’t given it’s value in the Wally class at that stage. How do I access typeOfPerson from the Man class? If what I am asking for is not possible and I am going about this completely the wrong way. What is the correct way to do this?
Thanks.