                 else
                     layoutElementHeight = layoutElement.getPreferredBoundsHeight();
                     
-                contentHeight = Math.max(contentHeight, layoutElementHeight);
+                containerHeight = Math.max(containerHeight, layoutElementHeight);
             }
         }
 

     *  following is true:
     * 
     *  - If verticalAlign is "middle" then y is set so that the element's preferred
     *  height is centered within the contentHeight:
     *      y = (contentHeight - layoutElementHeight) * 0.5
     * 
     *  - If verticalAlign is "bottom" the y is set so that the element's bottom
     *  edge is aligned with the the bottom edge of the content:
     *      y = (contentHeight - layoutElementHeight)
     * 
     *  Implementation note: unless verticalAlign is either "justify" or 
     *  "top", the layout elements' y or height depends on the contentHeight.

        // If verticalAlign is top, we don't need to figure out the contentHeight.
        // Otherwise the contentHeight is used to position the element and even size 
        // the element if it's "contentJustify" or "justify".
        var containerHeight:Number = targetHeight;
        
        
        // TODO: in the middle or bottom case, we end up calculating percentHeight 
