# Creating Dynamic vars

**URL:** <https://forum.kirupa.com/t/creating-dynamic-vars/267595>\
**Category:** flash\
**Created:** [August 3, 2008, 5:47pm UTC](https://forum.kirupa.com/t/creating-dynamic-vars/267595 "2008-08-03T17:47:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![coggia](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@coggia](https://forum.kirupa.com/u/coggia)\
**Post date:** [August 3, 2008, 5:47pm UTC](https://forum.kirupa.com/t/creating-dynamic-vars/267595/1 "2008-08-03T17:47:30Z")

</div>

Hello,  
I’ve got little problems to create dynamic variables and i’m looking everywhere for the right syntax, but i cannot get this code works :

```
public function drawStage(tBitmaps:Array){

    
    var c0:Bitmap ;var c1:Bitmap ;var c2:Bitmap ;
    //here i'd like to place a loop to create my c's dynamically
    //but got some syntax problems i guess
    var lng:int = 3;
    
    
    for(var i:int=0;i&lt;lng; i++){
        
        this["c"+i]= new Bitmap( tBitmaps*);
        //here it wont work, unless i wrote
        //c0 = new Bitmap( tBitmaps*);
        
    }
}

```

What’s the main difference between c0 (working) and this[“c”+0] (not working) ?
