# How to create a new sprite each time with a different name

**URL:** https://forum.kirupa.com/t/how-to-create-a-new-sprite-each-time-with-a-different-name/279537
**Category:** Uncategorized
**Created:** [January 15, 2009, 8:10pm UTC](https://forum.kirupa.com/t/how-to-create-a-new-sprite-each-time-with-a-different-name/279537 "2009-01-15T20:10:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![scarjoh](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@scarjoh](https://forum.kirupa.com/u/scarjoh)
#### Post date: [January 15, 2009, 8:10pm UTC](https://forum.kirupa.com/t/how-to-create-a-new-sprite-each-time-with-a-different-name/279537/1 "2009-01-15T20:10:13Z")

</div>

this part of code scans through xml file and places text inside sprites:

[http://pastie.org/361746](http://pastie.org/361746)

and it looks like this basically:

[![](http://img58.imageshack.us/img58/9599/19851906qw4.jpg)](http://imageshack.us)

now there can be more, less or none of these ‘groups’ and everything is fine with that part of code, but right now each ‘group’ is placed in a new sprite called mc2 (i am declaring and adding them on line 6 - 7), and then on line 28 - 30 filling them with text.

the problem now is that both of these ‘groups’ are inside of sprite called mc2, so if i say:  
mc2.visible = false; - both of them will be invisible… and i need to control them individually.

(their instance names are different, but both of them are mc2)

so how can i create a new sprite each time with a different name?  
like mc0, mc1, mc2 and so on (as much as there is need for)…?

i tried to say something like: [http://pastie.org/361775](http://pastie.org/361775) but it doesnt work 😛  
(look at the lines 6-7, and 28 - 30 again)
