PDA

View Full Version : creating an array with a dynamic name?


Herke
09-07-2008, 01:11 PM
Hi, really struggling with this.

Say i have an array:
var myArray = ["cheese", "milk", "eggs"];

what i now want to do is loop through this array and create a new array for each element in myArray, so now i would have 4 arrays:

myArray:Array
cheese:Array
milk:Array
eggs:Array

i cant work out how to do it on the fly though, like
var this[myArray[i]]:Array = new Array();

do you see what im getting at? Its in a class if that makes any difference
help much appreciated!
Cheers, Neil