         if (!g || (index < 0) || (index >= g.numElements)) 
             return null;
 
-        var col:int = index % _columnCount;
-        var row:int = index / Math.max(1, _columnCount);
+        var col:int;
+        var row:int;
+        if (orientation == TileOrientation.ROWS)
+        {
+            col = index % _columnCount;
+            row = index / _columnCount;
+        }
+        else
+        {
+            col = index / _rowCount;
+            row = index % _rowCount
+        }
         return new Rectangle(leftEdge(col), topEdge(row), _columnWidth, _rowHeight);
     }
 

        bounds.bottom = bottomEdge(row);
        return bounds;
    }
}
}


import spark.components.supportClasses.GroupBase;
import spark.core.NavigationUnit;
import spark.layouts.supportClasses.DropLocation;
import spark.layouts.supportClasses.LayoutBase;

/**
