# Nested Arrays

**URL:** <https://forum.kirupa.com/t/nested-arrays/308691>\
**Category:** flash\
**Created:** [April 28, 2010, 10:56am UTC](https://forum.kirupa.com/t/nested-arrays/308691 "2010-04-28T10:56:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thequ1ck](https://avatars.discourse-cdn.com/v4/letter/t/9de053/32.png) [@thequ1ck](https://forum.kirupa.com/u/thequ1ck)\
**Post date:** [April 28, 2010, 10:56am UTC](https://forum.kirupa.com/t/nested-arrays/308691/1 "2010-04-28T10:56:07Z")

</div>

I’m sure this must have come up before but how do you generate nested arrays in as3?

In AS2 I believe you could simply write arrayX[a]\*\*[c] = d;  
but in AS3 you need to declare each nested array e.g.

function someFunction(a:String, b:String, c:String, d:Array)  
{  
arrayX[a] = new Array();  
arrayX[a]\*\* = new Array();  
arrayX[a]\*\*[c] = d;  
};

This doesn’t throw any errors but when used in a function, any subsequent  
values overwrite the existing arrays. e.g. with differing values of a,b,c and d  
the trace of arrayX[a]\*\*[c].length will always be the value of the last run of the function.

Any help on this would be very very much appreciated!
