# Dynamically creating Variable NAMES in AS3

**URL:** <https://forum.kirupa.com/t/dynamically-creating-variable-names-in-as3/287998>\
**Category:** flash\
**Created:** [May 9, 2009, 3:32am UTC](https://forum.kirupa.com/t/dynamically-creating-variable-names-in-as3/287998 "2009-05-09T03:32:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsyapril88](https://avatars.discourse-cdn.com/v4/letter/b/779978/32.png) [@bsyapril88](https://forum.kirupa.com/u/bsyapril88)\
**Post date:** [May 9, 2009, 3:32am UTC](https://forum.kirupa.com/t/dynamically-creating-variable-names-in-as3/287998/1 "2009-05-09T03:32:21Z")

</div>

The idea is to use a loop to create a set of variable names. The forums have figured out how to do this in AS2. Is it possible in AS3?

This works in AS2…

```php
for(var x=0; x<3; x++) {    
this["var"+x] = x;
}
trace(var1); // 1
trace(var2); // 2

```

This was from [http://www.actionscript.org/forums/showthread.php3?t=115569](http://www.actionscript.org/forums/showthread.php3?t=115569).
