How can I initialise two-dimentional typed Vector is AS3?
Now I can get working only this:
private var _mainArray : Array = new Array( MyConst.DIMENTION );
public function MyArray()
{
for ( var i : int = 0; i < MyConst.DIMENTION; i++ ) {
_mainArray[ i ] = new Vector.<int>( MyConst.DIMENTION );
}
}
...
_mainArray[ i ][ j ] = 0;
What you have is an Array of Vector of int. What you want is a Vector of Vector of int.
So your "outer" Vector has to declare that contains elements of type Vector.<int>
Something like this (of course you can use a for loop):
var v:Vector.<Vector.<int>> = new Vector.<Vector.<int>>(2);
v[0] = new Vector.<int>(2);
v[1] = new Vector.<int>(2);
v[0][0] = 0;
v[0][1] = 1;
v[1][0] = 2;
v[1][1] = 3;
trace(v);