# Dynamic Instance Naming

**URL:** <https://forum.kirupa.com/t/dynamic-instance-naming/305073>\
**Category:** flash\
**Created:** [February 18, 2010, 9:10pm UTC](https://forum.kirupa.com/t/dynamic-instance-naming/305073 "2010-02-18T21:10:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cortezcreations](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@cortezcreations](https://forum.kirupa.com/u/cortezcreations)\
**Post date:** [February 18, 2010, 9:10pm UTC](https://forum.kirupa.com/t/dynamic-instance-naming/305073/1 "2010-02-18T21:10:59Z")

</div>

Hello All  
So here’s my problem.  
I’ve created an array from XML elements.  
I have my index saved in the var i

```auto
mc.index = i;

```

Now the problem I’m facing is dynamically changing a section of code.  
I had to hardcode like this for now.

```auto
mc.onPress=function(){
if (this.index==0){
point0.frame._visible=true;
}
if (this.index==1){
point1.frame._visible=true;
}
}

```

When what I’d like to achieve is

```auto
 mc.onPress=function(){
point[this.index]._visible=true;
}

```

Any help on the syntax please!
