- Home /
This question was
closed Oct 04, 2014 at 02:01 PM by
fafase for the following reason:
The question is answered, right answer was accepted
Question by
Peffern · Sep 28, 2014 at 10:20 PM ·
arrayspritemultidimensional array
How do I create a 3 dimensional 2x2x2 Array of Sprites?
I'm trying to create a 3D array, then fill it with Sprites. I tried using
var spritesArray : Sprite[][][]
but that wouldn't work, so I tried to create a blank array :
var SpritesArray = new Array();
SpritesArray[0] = new Array();
SpritesArray[1] = new Array();
SpritesArray[0][0] = new Array();
SpritesArray[0][1] = new Array();
SpritesArray[1][0] = new Array();
SpritesArray[1][1] = new Array();
But now even that won't create. It's just a blank array? How do I create a 3D Array?
Comment
Best Answer
Answer by Eric5h5 · Sep 28, 2014 at 10:25 PM
Never use the Array class; it's slow and untyped.
var spritesArray = new Sprite[2, 2, 2];
Thanks. I got it working. I used var SpritesArray : Sprite[,,] = new Sprite[2,2,2];
but it's basically the same thing.