# No dynamic arrays in classes?

**URL:** https://forum.kirupa.com/t/no-dynamic-arrays-in-classes/298944
**Category:** Uncategorized
**Created:** [October 27, 2009, 3:34pm UTC](https://forum.kirupa.com/t/no-dynamic-arrays-in-classes/298944 "2009-10-27T15:34:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![flashpipe](https://avatars.discourse-cdn.com/v4/letter/f/839c29/32.png) [@flashpipe](https://forum.kirupa.com/u/flashpipe)
#### Post date: [October 27, 2009, 3:34pm UTC](https://forum.kirupa.com/t/no-dynamic-arrays-in-classes/298944/1 "2009-10-27T15:34:22Z")

</div>

Not sure what I’m missing here, but if I create a new AS3 file with the following code:

```auto
function createArrays():void {
    for(var i:uint=0;i<3;i++){
        trace(i);
        this["array"+i]=new Array();
        this["array"+i].push("item1");
        this["array"+i].push("item2");
    }
    trace(this["array"+0].toString())
}
createArrays();

```

it traces fine and works…

If I set my document class to tst.as, remove all except the last line and put the following in a tst.as file:

```auto
package {

    import flash.display.MovieClip;
    import flash.events.*;

    public class tst extends MovieClip {
        
        public function createArrays():void {
            for(var i:uint=0;i<3;i++){
                trace(i);
                this["array"+i]=new Array();
                this["array"+i].push("item1");
                this["array"+i].push("item2");
            }
            trace(this["array"+0].toString())
        }
    }
}

```

I get an error saying:  
ReferenceError: Error #1056: Cannot create property array0 on tst.  
at tst/createArrays()  
at tst/frame1()

Am I missing something, or are there functions you can’t build in external as but you can in the IDE?

Thanks!!
