# Variables in a loop?help!

**URL:** <https://forum.kirupa.com/t/variables-in-a-loop-help/154124>\
**Category:** Uncategorized\
**Created:** [July 7, 2005, 4:14am UTC](https://forum.kirupa.com/t/variables-in-a-loop-help/154124 "2005-07-07T04:14:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![meanpeople](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@meanpeople](https://forum.kirupa.com/u/meanpeople)\
**Post date:** [July 7, 2005, 4:14am UTC](https://forum.kirupa.com/t/variables-in-a-loop-help/154124/1 "2005-07-07T04:14:50Z")

</div>

help me with this problem. The script creates a movieclip for each image which when i click will show an image on a root movieclip…but when clicked,it outputs undefined…

```auto
addressVars= new LoadVars();
addressVars.load("[http://localhost/test/flashmx_dbPassReturn.php](http://localhost/test/flashmx_dbPassReturn.php)");
addressVars.onLoad = function() {
for (i=0; i<this.n; i++){
myMC = createEmptyMovieClip("holder"+i, i);
myContainer = myMC.createEmptyMovieClip("container", 1);
myContainer.loadMovie(this["picFile"+i]);
  myMC._x = (40*i);
myMC._y = (1*i);
myMC.i = i;
myMC.onPress = function (){
trace (this["picFile"+i]);
_root.screen.loadMovie(this["picFile"+i]); }
}
}
}

```

i think the problem is that in the onPress function, it can’t define the “picFile” which i call from the database…help me please!!!
