I want to swap columns and rows in an array. What I want is to take column one and swap it for columns 2 or 3. Or I would like to do the same for rows.
I have an array with 9 columns and rows. I need a way to swap rows 1-3, 4-6, 7-9 with eachother randomly eachtime to the movie is started. I also want to do the same thing with the columns but not at the same time with the rows.
What I have is this:
var num = 0;
var gridx = 50;
var gridy = 50;
var easy1:Array = new Array();
easy1 = [["", "","", "","","", "","",""],
["", "","", "","1","6"," 9","5",""],
["", "4","", "","5","", "","","1"],
["", "3","", "","","", "","",""],
["", "8","", "","","4", "","6","2"],
["7", "","4", "5","","", "8","3",""],
["", "5","2", "6","","", "","",""],
["", "","", "","9","8", "","","6"],
["", "","6", "","","", " 4","9","7"]]
/////////////////////////////////////////////////////// loops
sudBox = new Array(9);
for (var i = 0; i<9; i++) {
sudBox* = new Array(9);
for (var j = 0; j<9; j++) {
sudBox*[j] = bx.duplicateMovieClip("bx"+num, num);
sudBox*[j].dayT = easy1*[j];
sudBox*[j]._y = gridx*i+0;
sudBox*[j]._x = gridy*j+0;
num++;
}
}
Anyone have an idea how I get started with this?