2D Vector

var map:Vector.<Vector.<int>> = new Vector.<Vector.<int>>();
map[0] = new Vector.<int>();
map[0].push(1);
map[0].push(0);
map[0].push(0);

map[1] = new Vector.<int>();
map[1].push(0);
map[1].push(1);
map[1].push(0);

map[2] = new Vector.<int>();
map[2].push(0);
map[2].push(0);
map[2].push(1);

/*
map:
1,0,0
0,1,0
0,0,1
*/

This creates a two dimensional Vector of ints (flash 10 player only). The first line is the real snippet… took me a few minutes to get the syntax right the first time I needed a 2D Vector.

Leave a Reply

Your email address will not be published. Required fields are marked *