# addChild can't add dynamically created mcs?

**URL:** https://forum.kirupa.com/t/addchild-cant-add-dynamically-created-mcs/295449
**Category:** flash
**Created:** [August 30, 2009, 4:07pm UTC](https://forum.kirupa.com/t/addchild-cant-add-dynamically-created-mcs/295449 "2009-08-30T16:07:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![OMG](https://avatars.discourse-cdn.com/v4/letter/o/9dc877/32.png) [@OMG](https://forum.kirupa.com/u/OMG)
#### Post date: [August 30, 2009, 4:07pm UTC](https://forum.kirupa.com/t/addchild-cant-add-dynamically-created-mcs/295449/1 "2009-08-30T16:07:46Z")

</div>

I used a loop to create a series of instances of a class called “Ball”: ball\_0, ball\_1, ball\_2, etc.

But then somewhere else I need to add them on the stage. When I use stage.addChild(Ball(“ball\_”+ballNum)) it gives me this error:  
TypeError: Error #1034: Type Coercion failed: cannot convert “ball\_3” to Ball.

(ballNum was set to 3 at that time)  
it seems there’s a new syntax (or something) that I don’t get. I get the same type of errors when using other functions such as stage.contains()

thanks in advance
