I have a class named Level
which inherits MovieClip
. Level
has a child in the designer with the name gridView
and the gridView
is used in Level
constructor.
I have also class named Level1
which inherits Level
. when I try something like addChild(new Level1())
I get error in Level
constructor saying gridView
is null. What am I doing wrong?
Some parts of the code:
public class Level extends MovieClip
{
public function Level()
{
var matrix:Matrix = new Matrix();
matrix.translate(-250, -250);
matrix.rotate(Math.PI / 6);
matrix.scale(1, 0.5);
matrix.translate(250, 250);
gridView.transform.matrix = matrix; // error here referred from:
}
}
public class Level1 extends Level
{
public function Level1()
{
super();
}
}
addChild(new Level1()); // referred from here
addChild(new Level()); // this worked fine