Hello,
I have a child class that is loaded into the parent class when the swf begins, like so:
var myvar = 'hello';
public function Parent()
{
this.child = new Child();
};
How can I retrieve the variable 'myvar' from within child?
Hello,
I have a child class that is loaded into the parent class when the swf begins, like so:
var myvar = 'hello';
public function Parent()
{
this.child = new Child();
};
How can I retrieve the variable 'myvar' from within child?
Child has no reference to the parent, so there is no way to retrieve myvar.
You could create child like this:
public class Child
{
private var parent:Parent;
public Child(parent:Parent)
{
this.parent = parent;
}
...
}
This will allow the child to access it's parent through it's parent property and will be able to see all the public members that belong to parent.