# Recognizing strings as instance names

**URL:** https://forum.kirupa.com/t/recognizing-strings-as-instance-names/298986
**Category:** flash
**Created:** [October 28, 2009, 7:30am UTC](https://forum.kirupa.com/t/recognizing-strings-as-instance-names/298986 "2009-10-28T07:30:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![romit\_2034](https://avatars.discourse-cdn.com/v4/letter/r/ed655f/32.png) [@romit\_2034](https://forum.kirupa.com/u/romit_2034)
#### Post date: [October 28, 2009, 7:30am UTC](https://forum.kirupa.com/t/recognizing-strings-as-instance-names/298986/1 "2009-10-28T07:30:47Z")

</div>

I have something like this as a part of my code

```auto

var gen:particle;
var a:int = 0;
var b:int = 1;

for (var i:int=0; i<100; i++)
{
    gen = new particle();
    addChild(gen);
    gen.x = a;
    a = a+20;
    gen.name = ("n" + i);
}

addEventListener(Event.ENTER_FRAME, loop2);

function loop2(e:Event)
{
    for(var i:int=0; i<100; i++)
         {
     
         }
    
}

```

As you can see i am creating instances of \*particle \*and adding them stage and then giving them instance names.

Now in the empty event handler function I want to access these instances of particle I created by their instance names and change their rotationX values.

The question is how do I call these instance names in the for loop in the second function. I can generate the string pretty easily, but how do I get flash to recognize these strings as instance names?
