Hello!
I am always confused how to find the Num of Children in a particular case, as below.
I am trying to figure out how many birds are there at a particular time, so that I may control their growth.
var timer: Timer = new Timer(500, 45);
timer.addEventListener(TimerEvent.TIMER, timerFunc);
timer.start();
function timerFunc(event: TimerEvent): void
{
var mcBird: myBird = new myBird();
var yVal: Number = (Math.ceil(Math.random()*100));
mcBird.x = 750;
mcBird.y = yVal;
addChild(mcBird);
trace("Num of Birds = " + mcBird.Parent.numChildren); // [COLOR=#a52a2a]*This is the point of my problem*[/COLOR]
}
If a geek explains me where to use “parent”, “this”, and “root” etc. it can help me for the future as well.
Thanks in anticipation.
Raabi