Angha110
asked on
Add Child dynamically in a loop
Hi,
I am creating new instances from a movie clip in library and adding it to a container on the stage. I also need to add a child to that already added child. Some thing like this in a loop.
var bar:YearBar=new YearBar();
myContainer.addChild(bar);
then I have to do this:
var cube:Cube=new Cube();
I want to add this to the bar, so I did this:
myContainer.bar.addChild(c ube);
But I am getting error.
Please note all these are happening in a loop and I need to create different number of these instances.
What am I doing wrong?
I am creating new instances from a movie clip in library and adding it to a container on the stage. I also need to add a child to that already added child. Some thing like this in a loop.
var bar:YearBar=new YearBar();
myContainer.addChild(bar);
then I have to do this:
var cube:Cube=new Cube();
I want to add this to the bar, so I did this:
myContainer.bar.addChild(c
But I am getting error.
Please note all these are happening in a loop and I need to create different number of these instances.
What am I doing wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for the responses. It works great.
Open in new window
Warm Regards
Deepanjan Das