# How do i dynamicly declares private vars?

**URL:** <https://forum.kirupa.com/t/how-do-i-dynamicly-declares-private-vars/321257>\
**Category:** Uncategorized\
**Created:** [April 14, 2011, 12:16pm UTC](https://forum.kirupa.com/t/how-do-i-dynamicly-declares-private-vars/321257 "2011-04-14T12:16:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![keitai](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@keitai](https://forum.kirupa.com/u/keitai)\
**Post date:** [April 14, 2011, 12:16pm UTC](https://forum.kirupa.com/t/how-do-i-dynamicly-declares-private-vars/321257/1 "2011-04-14T12:16:11Z")

</div>

Hi there,

I have 20 cubes and i like to know how to dynamicly declare them

```auto

public class Dia01 extends BasicView {
    var i:int;
    for (i = 0; i < 10; i++ ) {
    private var cube:Cube = this["cube" + i];
    }

//private var cube0:Cube;
    //private var cube1:Cube;
    //private var cube2:Cube;
    //private var cube3:Cube;

```

above didn’t work

2/ i have 4 different color states for each cube and i am thinking of using a matrix to color the cubes. Any tips or suggestion?

regards
