Hello,

I have a list of 9 values:

Code:
1
2
3
4
5
6
7
8
9
and I divided this list in groups of 3 elements like this:

Code:
1  4  7
2  5  8
3  6  9
using this code:

Code:
var str:String = "1\n2\n3\n4\n5\n6\n7\n8\n9"
var COL_SIZE:int = 3; //maximum number of values in a column
var allValues:Array=str.split("\n");
var output:String = "";
for (var i:int=0;i<COL_SIZE && i<allValues.length;i++) {
    var j:int = 0;
    while (i+j<allValues.length) {
        	output+=allValues[i+j]+"\t";
        	j+=COL_SIZE;
    }
    output+="\n";
}
How to re-arrange this matrix in order to obtain this output:

Code:
7
8
9
4
5
6
1
2
3
Thanks!