Array rotate

by John_Blackburne
♥0 | Line 28 | Modified 2012-01-17 18:29:52 | MIT License
play

ActionScript3 source code

/**
 * Copyright John_Blackburne ( http://wonderfl.net/user/John_Blackburne )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/tAPA7
 */

package {
    import flash.display.Sprite;
    import flash.text.TextField;

    public class FlashTest extends Sprite {
        
        public var table:Array = [[1, 2, 3],[4, 5, 6]];
        public var tabW:int = 3;
        public var tabH:int = 2;
        
        public var alsotable:Array;
        
        public var str:TextField;
        
        public function FlashTest() {
            var i:int, j:int;
            
            str = new TextField();
            addChild(str);
            
            
            str.text = "test\n";
        
            str.appendText(String(table) + "\n");
        
            alsotable = new Array(tabW);
            for (i=0; i < tabW; i++)
            {
                alsotable[i] = new Array();
                for (j=0; j < tabH; j++)
                {
                    alsotable[i][j] = table[j][tabW - 1 - i];
                }
            }
            str.appendText(String(alsotable));
        }
    }
}