# Replacing instance name with variable

**URL:** <https://forum.kirupa.com/t/replacing-instance-name-with-variable/48298>\
**Category:** Uncategorized\
**Created:** [April 12, 2004, 10:11am UTC](https://forum.kirupa.com/t/replacing-instance-name-with-variable/48298 "2004-04-12T10:11:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![freeman](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/freeman/32/508_2.png) [@freeman](https://forum.kirupa.com/u/freeman)\
**Post date:** [April 12, 2004, 10:11am UTC](https://forum.kirupa.com/t/replacing-instance-name-with-variable/48298/1 "2004-04-12T10:11:38Z")

</div>

[font=Arial]hi hi, me again. [/font]  
[font=Arial]i’m trying to set property with a movie clip instance when it is displayed on the stage, with pre-defined functions on the first frame:[/font]

```auto
 setPro = function(movname){
movname.onEnterFrame = function(){
if(this._alpha > 0){
this._alpha -= 10;
}
} 

```

and in the frame where the movie clip named “mov1” is present on the stage, i put:

```auto
 setPro("mov1"); 

```

but the code doesn’t work because it is searching for a movie clip called “movname” instead of replacing it with “mov1”.  
is there any method to overcome this?
