 	{
 		if (super.direction != value)
 		{
+            // Direction has changed so we reset the last child's
+            // percentWidth/percentHeight setting. Note that
+            // we call this before assigning the new direction value
+            // as resetStrechedChild() depends on the direction.
+            resetStretchedChild();
+
 			super.direction = value;
 
 			// Need to invalidate all our dividers

		for (var i:int = 0; i < n; i++)
		{
			var child:IUIComponent = getLayoutChildAt(i);
		
			var sz:Number = vertical ? child.height : child.width;



		else if (!child.includeInLayout && --numLayoutChildren > 0)
			dividerLayer.removeChild(getDividerAt(numLayoutChildren - 1));

        // Clear the stretched child as the new last child
        // will be set to 100% in preLayoutAdjustment().
        resetStretchedChild();

        // Clear the cached values so that we do another
        // measurement pass.
        dbMinWidth = NaN;
        dbMinHeight = NaN;
        dbPreferredWidth = NaN;
        dbPreferredHeight = NaN;
        invalidateSize();
	}
	
}
