# AddChild and Variable in MC Class

**URL:** <https://forum.kirupa.com/t/addchild-and-variable-in-mc-class/250235>\
**Category:** flash\
**Created:** [January 27, 2008, 2:08pm UTC](https://forum.kirupa.com/t/addchild-and-variable-in-mc-class/250235 "2008-01-27T14:08:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrutter](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jrutter/32/2004_2.png) [@jrutter](https://forum.kirupa.com/u/jrutter)\
**Post date:** [January 27, 2008, 2:08pm UTC](https://forum.kirupa.com/t/addchild-and-variable-in-mc-class/250235/1 "2008-01-27T14:08:29Z")

</div>

So basically Im trying to assign a varible movie clip to the stage based off a number in my XML file. Im successful in extracting that number, Im just unsuccessful in creating a new variable MC name in AddChild. Ive been searching the internet for an answer and have been coming up blank.

Anyone have any ideas?

Here is my code:

```auto
var star1Num:Number = xml.city[index].cityprice.starcount[1].toString();
    
    trace(star1Num);
    
    popInfo.addChild(star1sp);
    star1sp.y = 70;
    star1sp.x = -10;
    star1sp.addChild((star + [star1Num]));

```
