         layoutTarget.measuredWidth = preferredWidth;
         layoutTarget.measuredHeight = (explicitRowCount == -1) ? preferredHeight : visibleHeight;
 
-        layoutTarget.contentWidth = preferredWidth;
-        layoutTarget.contentHeight = preferredHeight;
-
         layoutTarget.measuredMinWidth = minWidth; 
         layoutTarget.measuredMinHeight = minHeight;
+
+        layoutTarget.setContentSize(preferredWidth, preferredHeight);
     }
    
    

        
        layoutTarget.measuredWidth = columnWidth;
        layoutTarget.measuredHeight = visibleHeight;
        
        layoutTarget.contentWidth = columnWidth; 
        layoutTarget.contentHeight = contentHeight;

        layoutTarget.measuredMinWidth = minColumnWidth;
        layoutTarget.measuredMinHeight = rowHeight;
    }
    
    

        
        // Finally, position the objects        
        var y:Number = 0;
        var maxX:Number = 0;
        var maxY:Number = 0;
        for each (var lo:ILayoutItem in layoutItemArray)
        {
            var x:Number = (unscaledWidth - lo.actualSize.x) * hAlign;
            lo.setActualPosition(x, y);
            var dx:Number = lo.actualSize.x;
            if (!variableRowHeight)
                lo.setActualSize(dx, rowHeight);
            var dy:Number = lo.actualSize.y;
            maxX = Math.max(maxX, x + dx);
            maxY = Math.max(maxY, y + dy);
            if ((explicitRowCount == -1) && (y < maxVisibleY) && ((y + dy) > minVisibleY)) 
            	visibleRows += 1;
            y += dy + gap;
        }
        if (explicitRowCount == -1) 
        	setRowCount(visibleRows);
        layoutTarget.setContentSize(maxX, maxY);
    }
    
    
