I have a 2D array, let’s use this example:
var my_ary:Array = new Array();
my_ary[0] = [0,0,0,1,1,4,5,6];
my_ary[1] = [1,1,3,4,4,3,3,4];
my_ary[2] = [0,1,3,4,6,7,8,9];
I need to have a ‘swap’ function, and I have one that works great for a one dimensional array as follows:
Array.prototype.swap = function(fromIndex:int, toIndex:int):void {
var temp:* = this[toIndex];
this[toIndex] = this[fromIndex];
this[fromIndex] = temp;
}
however this is not working for my because I want to swap array index:
my_ary[0][3]
with
my_ary[2][6]
Any help?