# How do I addChild dynamically using a variable?

**URL:** <https://forum.kirupa.com/t/how-do-i-addchild-dynamically-using-a-variable/327984>\
**Category:** flash\
**Created:** [April 11, 2012, 1:32am UTC](https://forum.kirupa.com/t/how-do-i-addchild-dynamically-using-a-variable/327984 "2012-04-11T01:32:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shava304](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@shava304](https://forum.kirupa.com/u/shava304)\
**Post date:** [April 11, 2012, 1:32am UTC](https://forum.kirupa.com/t/how-do-i-addchild-dynamically-using-a-variable/327984/1 "2012-04-11T01:32:46Z")

</div>

hi AS3 experts,  
I want to addChild to stage dynamically using a variable. In AS2, i would have done it using eval().

In the attached page1.as file, I want to be able to use the for() loop instead of the commented out code.

Can anyone help me with this code please???

Thanks heaps in advance.
