# Using variable value

**URL:** <https://forum.kirupa.com/t/using-variable-value/274401>\
**Category:** flash\
**Created:** [October 29, 2008, 3:06pm UTC](https://forum.kirupa.com/t/using-variable-value/274401 "2008-10-29T15:06:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hugot](https://avatars.discourse-cdn.com/v4/letter/h/45deac/32.png) [@hugot](https://forum.kirupa.com/u/hugot)\
**Post date:** [October 29, 2008, 3:06pm UTC](https://forum.kirupa.com/t/using-variable-value/274401/1 "2008-10-29T15:06:07Z")

</div>

Hi:

I have this function and code:

```auto
 
for (i=0; i<=4; i++) {
   eval("m"+i).onRelease = function() {
    carrega_movie(i,10,10);
    };
}
function carrega_movie(movie,posx,posy) {
 container._x = posx;
 container._y = posy;
 container.loadMovie(movie);
}
 

```

I want to assign an Onrelease function for each movie using the “i” value

But it assumes i=5 (because of my for loop), and i want it to be 0,1,2,3… in movies m0,m1, m2 …

Is there any solution to make this work so that the function carrega\_movie uses the temporary value of i assigned in the for loop?

Many thanks for your help
