# Create variables inside a for-loop

**URL:** <https://forum.kirupa.com/t/create-variables-inside-a-for-loop/289326>\
**Category:** Uncategorized\
**Created:** [May 29, 2009, 12:46am UTC](https://forum.kirupa.com/t/create-variables-inside-a-for-loop/289326 "2009-05-29T00:46:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![quicksmack](https://avatars.discourse-cdn.com/v4/letter/q/fbc32d/32.png) [@quicksmack](https://forum.kirupa.com/u/quicksmack)\
**Post date:** [May 29, 2009, 12:46am UTC](https://forum.kirupa.com/t/create-variables-inside-a-for-loop/289326/1 "2009-05-29T00:46:08Z")

</div>

i am trying to “dynamically” create variable names inside a for loop and add them to an array…

var thumbsArray:Array = new Array;

```auto
for (var i:Number; i < 5; i++)
{
     var this["thumb" + i]:Loader = new Loader;
     thumbsArray.push(this["thumb" + i]);
     this["thumb" + i].load(new URLRequest("images/samplepic.jpg");
     addChild(this["thumb" + i]);
}
// ' this["thumb" + i] ' is definitely not the way to write it.. so how should i write it?

```
