This is an automated email from the ASF dual-hosted git repository.

pent pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/feature/MXRoyale by this push:
     new d315549  Added BoxLayout as a bead and updated some core classes and 
added a few new classes as needed by BoxLayout. Partially working.
d315549 is described below

commit d315549d83296b2a319488c4bc4b2ffcffc9f2b5
Author: Peter Ent <[email protected]>
AuthorDate: Thu Mar 15 16:41:24 2018 -0400

    Added BoxLayout as a bead and updated some core classes and added a few new 
classes as needed by BoxLayout. Partially working.
---
 .../MXRoyale/src/main/royale/MXRoyaleClasses.as    |   1 +
 .../MXRoyale/src/main/royale/mx/containers/Box.as  |  31 +-
 .../main/royale/mx/containers/beads/BoxLayout.as   | 464 ++++++++++++++
 .../royale/mx/containers/utilityClasses/Flex.as    | 678 +++++++++++++++++++++
 .../mx/containers/utilityClasses/FlexChildInfo.as  | 212 +++++++
 .../MXRoyale/src/main/royale/mx/core/Container.as  |  79 ++-
 .../src/main/royale/mx/core/EdgeMetrics.as         | 241 ++++++++
 .../src/main/royale/mx/core/IUIComponent.as        |   6 +
 .../src/main/royale/mx/core/UIComponent.as         |  49 +-
 9 files changed, 1733 insertions(+), 28 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as 
b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index 79a5c5f..ef760d6 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -29,6 +29,7 @@ internal class MXRoyaleClasses
 {
     import mx.core.UIComponent; UIComponent;
        import mx.core.Container; Container;
+       import mx.containers.beads.BoxLayout; BoxLayout;
 }
 
 }
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Box.as 
b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Box.as
index 80ad82f..a526a74 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Box.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Box.as
@@ -30,8 +30,8 @@ COMPILE::JS
 }
 /*
 import flash.events.Event;
-import mx.containers.utilityClasses.BoxLayout;
 */
+import mx.containers.beads.BoxLayout;
 import mx.core.Container;
 /*
 import mx.core.IUIComponent;
@@ -134,6 +134,10 @@ public class Box extends Container
     public function Box()
     {
         super();
+               
+               _layout = new BoxLayout();
+               _layout.direction = _direction;
+               addBead(_layout);
     }
 
     
//--------------------------------------------------------------------------
@@ -141,6 +145,8 @@ public class Box extends Container
     //  Variables
     //
     
//--------------------------------------------------------------------------
+       
+       private var _layout:BoxLayout;
 
     /**
      *  @private
@@ -187,18 +193,7 @@ public class Box extends Container
     {
                _direction = value;
                
-               var layoutBead:IBeadLayout = getBeadByType(IBeadLayout) as 
IBeadLayout;
-               //if (layoutBead) removeBead(layoutBead);
-               if (layoutBead) {
-                       trace("At this time the layoutBead cannot be removed 
because the active layout bead cannot have its strand un-set");
-                       return
-               }
-               
-//             if (_direction == BoxDirection.VERTICAL) {
-//                     addBead(new VerticalLayout()); // TBD: replace with 
MX-specific vertical layout
-//             } else {
-//                     addBead(new HorizontalLayout()); // TBD: replace with 
MX-specific horizontal layout
-//             }
+               _layout.direction = value;
                
                dispatchEvent(new Event("directionChanged"));
                dispatchEvent(new Event("layoutNeeded"));
@@ -215,11 +210,11 @@ public class Box extends Container
        {
                // set the layout bead based on the direction
                
-               if (_direction == BoxDirection.VERTICAL) {
-                       addBead(new VerticalLayout()); // TBD: replace with 
MX-specific vertical layout
-               } else {
-                       addBead(new HorizontalLayout()); // TBD: replace with 
MX-specific horizontal layout
-               }
+//             if (_direction == BoxDirection.VERTICAL) {
+//                     addBead(new VerticalLayout()); // TBD: replace with 
MX-specific vertical layout
+//             } else {
+//                     addBead(new HorizontalLayout()); // TBD: replace with 
MX-specific horizontal layout
+//             }
                
                super.addedToParent();
        }
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BoxLayout.as 
b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BoxLayout.as
new file mode 100644
index 0000000..ab72b70
--- /dev/null
+++ 
b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/beads/BoxLayout.as
@@ -0,0 +1,464 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.containers.beads
+{
+       
+       import mx.containers.BoxDirection;
+       import mx.containers.utilityClasses.Flex;
+       import mx.core.Container;
+       import mx.core.EdgeMetrics;
+       import mx.core.IUIComponent;
+       
+       import org.apache.royale.core.IStrand;
+       import org.apache.royale.core.LayoutBase;
+
+       //import mx.core.mx_internal;
+       //import mx.core.ScrollPolicy;
+       
+       //use namespace mx_internal;
+       
+       [ExcludeClass]
+       
+       /**
+        *  @private
+        *  The BoxLayout class is for internal use only.
+        */
+       public class BoxLayout extends LayoutBase
+       {               
+               
//--------------------------------------------------------------------------
+               //
+               //  Constructor
+               //
+               
//--------------------------------------------------------------------------
+               
+               /**
+                *  Constructor.
+                *  
+                *  @langversion 3.0
+                *  @playerversion Flash 9
+                *  @playerversion AIR 1.1
+                *  @productversion Flex 3
+                */
+               public function BoxLayout()
+               {
+                       super();
+               }
+               
+               
//--------------------------------------------------------------------------
+               //
+               //  Properties
+               //
+               
//--------------------------------------------------------------------------
+               
+               private var _strand:IStrand;
+               
+               override public function set strand(value:IStrand):void
+               {
+                       _strand = value;
+                       _target = value as Container;
+                       super.strand = value;
+                       
+               }
+               
+               private var _target:Container;
+               
+               public function get target():Container
+               {
+                       return _target;
+               }
+               
+               public function set target(value:Container):void
+               {
+                       _target = value;
+               }
+               
+               //----------------------------------
+               //  direction
+               //----------------------------------
+               
+               /**
+                *  @private
+                */
+               public var direction:String = BoxDirection.VERTICAL;
+               
+               
//--------------------------------------------------------------------------
+               //
+               //  Overridden methods
+               //
+               
//--------------------------------------------------------------------------
+               
+               /**
+                *  @private
+                *  Measure container as per Box layout rules.
+                */
+               public function measure():void
+               {                       
+                       var isVertical:Boolean = this.isVertical();
+                       
+                       var minWidth:Number = 0;
+                       var minHeight:Number = 0;
+                       
+                       var preferredWidth:Number = 0;
+                       var preferredHeight:Number = 0;
+                       
+                       var n:int = target.numChildren;
+                       var numChildrenWithOwnSpace:int = n;
+                       for (var i:int = 0; i < n; i++)
+                       {
+                               var child:IUIComponent = 
target.getLayoutChildAt(i);
+                               
+                               if (!child.includeInLayout)
+                               {
+                                       numChildrenWithOwnSpace--;
+                                       continue;
+                               }
+                               
+                               var wPref:Number = 
child.getExplicitOrMeasuredWidth();
+                               var hPref:Number = 
child.getExplicitOrMeasuredHeight();
+                               
+                               if (isVertical)
+                               {
+                                       minWidth = 
Math.max(!isNaN(child.percentWidth) ?
+                                               child.minWidth : wPref, 
minWidth);
+                                       
+                                       preferredWidth = Math.max(wPref, 
preferredWidth);
+                                       
+                                       minHeight += 
!isNaN(child.percentHeight) ?
+                                               child.minHeight : hPref;
+                                       
+                                       preferredHeight += hPref;
+                                       
+                               }
+                               else
+                               {
+                                       minWidth += !isNaN(child.percentWidth) ?
+                                               child.minWidth : wPref;
+                                       
+                                       preferredWidth += wPref;
+                                       
+                                       minHeight = 
Math.max(!isNaN(child.percentHeight) ?
+                                               child.minHeight : hPref, 
minHeight);
+                                       
+                                       preferredHeight = Math.max(hPref, 
preferredHeight);
+                                       
+                               }
+                       }
+                       
+                       var wPadding:Number = 
widthPadding(numChildrenWithOwnSpace);
+                       var hPadding:Number = 
heightPadding(numChildrenWithOwnSpace);
+                       
+                       target.measuredMinWidth = minWidth + wPadding;
+                       target.measuredMinHeight = minHeight + hPadding;
+                       
+                       target.measuredWidth = preferredWidth + wPadding;
+                       target.measuredHeight = preferredHeight + hPadding;
+                       
+                       // do this too??
+                       target.width = target.measuredWidth;
+                       target.height = target.measuredHeight;
+               }
+               
+               override public function layout():Boolean
+               {
+                       updateDisplayList(target.width, target.height);
+                       return true;
+               }
+               
+               /**
+                *  @private
+                *  Lay out children as per Box layout rules.
+                */
+               public function updateDisplayList(unscaledWidth:Number,
+                                                                               
                   unscaledHeight:Number):void
+               {                       
+                       var n:int = target.numChildren;
+                       if (n == 0)
+                               return;
+                       
+                       var vm:EdgeMetrics = target.viewMetricsAndPadding;
+                       
+                       var paddingLeft:Number = target.getStyle("paddingLeft");
+                       var paddingTop:Number = target.getStyle("paddingTop");
+                       
+                       var horizontalAlign:Number = getHorizontalAlignValue();
+                       var verticalAlign:Number = getVerticalAlignValue();
+                       
+                       var mw:Number = target.scaleX > 0 && target.scaleX != 1 
?
+                               target.minWidth / Math.abs(target.scaleX) :
+                               target.minWidth;
+                       var mh:Number = target.scaleY > 0 && target.scaleY != 1 
?
+                               target.minHeight / Math.abs(target.scaleY) :
+                               target.minHeight;
+                       
+                       if (host.isWidthSizedToContent() || 
host.isHeightSizedToContent()) {
+                               measure();
+                               if (host.isWidthSizedToContent()) unscaledWidth 
= target.measuredWidth;
+                               if (host.isHeightSizedToContent()) 
unscaledHeight = target.measuredHeight;
+                       }
+                       
+                       var w:Number = Math.max(unscaledWidth, mw) - vm.right - 
vm.left;
+                       var h:Number = Math.max(unscaledHeight, mh) - vm.bottom 
- vm.top;
+                       
+//                     var horizontalScrollBar:ScrollBar = 
target.horizontalScrollBar;
+//                     var verticalScrollBar:ScrollBar = 
target.verticalScrollBar;
+                       
+                       var gap:Number;
+                       var numChildrenWithOwnSpace:int;
+                       var excessSpace:Number;
+                       var top:Number;
+                       var left:Number;
+                       var i:int;
+                       var obj:IUIComponent;
+                       
+                       if (n == 1)
+                       {
+                               // This is an optimized code path for the case 
where there's one
+                               // child. This case is especially common when 
the Box is really
+                               // a GridItem. This code path works for both 
horizontal and
+                               // vertical layout.
+                               
+                               var child:IUIComponent = 
target.getLayoutChildAt(0);
+                               
+                               var percentWidth:Number = child.percentWidth;
+                               var percentHeight:Number = child.percentHeight;
+                               
+                               var width:Number;
+                               if (percentWidth)
+                               {
+                                       width = Math.max(child.minWidth,
+                                               Math.min(child.maxWidth,
+                                                       ((percentWidth >= 100) 
? w : (w * percentWidth / 100))));
+                               }
+                               else
+                               {
+                                       width = 
child.getExplicitOrMeasuredWidth();
+                               }
+                               
+                               var height:Number
+                               if (percentHeight)
+                               {
+                                       height = Math.max(child.minHeight,
+                                               Math.min(child.maxHeight,
+                                                       ((percentHeight >= 100) 
? h : (h * percentHeight / 100))));
+                               }
+                               else
+                               {
+                                       height = 
child.getExplicitOrMeasuredHeight();
+                               }
+                               
+                               // if scaled and zoom is playing, best to let 
the sizes be non-integer
+                               if (child.scaleX == 1 && child.scaleY == 1)
+                                       child.setActualSize(Math.floor(width), 
Math.floor(height));
+                               else
+                                       child.setActualSize(width, height);
+                               
+                               // Ignore scrollbar sizes for child alignment 
purpose.
+//                             if (verticalScrollBar != null &&
+//                                     target.verticalScrollPolicy == 
ScrollPolicy.AUTO)
+//                             {
+//                                     w += verticalScrollBar.minWidth;
+//                             }
+//                             if (horizontalScrollBar != null &&
+//                                     target.horizontalScrollPolicy == 
ScrollPolicy.AUTO)
+//                             {
+//                                     h += horizontalScrollBar.minHeight;
+//                             }
+                               
+                               // Use the child's width and height because a 
Resize effect might
+                               // have changed the child's dimensions. Bug 
146158.
+                               left = (w - child.width) * horizontalAlign + 
paddingLeft;
+                               top = (h - child.height) * verticalAlign + 
paddingTop;
+                               
+                               child.move(Math.floor(left), Math.floor(top));
+                       }
+                               
+                       else if (isVertical()) // VBOX
+                       {
+                               gap = target.getStyle("verticalGap");
+                               
+                               numChildrenWithOwnSpace = n;
+                               for (i = 0; i < n; i++)
+                               {
+                                       if 
(!IUIComponent(target.getChildAt(i)).includeInLayout)
+                                               numChildrenWithOwnSpace--;
+                               }
+                               
+                               // Stretch everything as needed, including 
widths.
+                               excessSpace = 
Flex.flexChildHeightsProportionally(
+                                       target, h - (numChildrenWithOwnSpace - 
1) * gap, w);
+                               
+                               // Ignore scrollbar sizes for child alignment 
purpose.
+//                             if (horizontalScrollBar != null &&
+//                                     target.horizontalScrollPolicy == 
ScrollPolicy.AUTO)
+//                             {
+//                                     excessSpace += 
horizontalScrollBar.minHeight;
+//                             }
+//                             if (verticalScrollBar != null &&
+//                                     target.verticalScrollPolicy == 
ScrollPolicy.AUTO)
+//                             {
+//                                     w += verticalScrollBar.minWidth;
+//                             }
+                               
+                               top = paddingTop + excessSpace * verticalAlign;
+                               
+                               for (i = 0; i < n; i++)
+                               {
+                                       obj = target.getLayoutChildAt(i);
+                                       left = (w - obj.width) * 
horizontalAlign + paddingLeft;
+                                       obj.move(Math.floor(left), 
Math.floor(top));
+                                       if (obj.includeInLayout)
+                                               top += obj.height + gap;
+                                       COMPILE::JS {
+                                               obj.element.style.position = 
'absolute';
+                                       }
+                               }
+                       }
+                               
+                       else  // HBOX
+                       {
+                               gap = target.getStyle("horizontalGap");
+                               
+                               numChildrenWithOwnSpace = n;
+                               for (i = 0; i < n; i++)
+                               {
+                                       if 
(!IUIComponent(target.getChildAt(i)).includeInLayout)
+                                               numChildrenWithOwnSpace--;
+                               }
+                               
+                               // stretch everything as needed including 
heights
+                               excessSpace = 
Flex.flexChildWidthsProportionally(
+                                       target, w - (numChildrenWithOwnSpace - 
1) * gap, h);
+                               
+                               // Ignore scrollbar sizes for child alignment 
purpose.
+//                             if (horizontalScrollBar != null &&
+//                                     target.horizontalScrollPolicy == 
ScrollPolicy.AUTO)
+//                             {
+//                                     h += horizontalScrollBar.minHeight;
+//                             }
+//                             if (verticalScrollBar != null &&
+//                                     target.verticalScrollPolicy == 
ScrollPolicy.AUTO)
+//                             {
+//                                     excessSpace += 
verticalScrollBar.minWidth;
+//                             }
+                               
+                               left = paddingLeft + excessSpace * 
horizontalAlign;
+                               
+                               for (i = 0; i < n; i++)
+                               {
+                                       obj = target.getLayoutChildAt(i);
+                                       top = (h - obj.height) * verticalAlign 
+ paddingTop;
+                                       obj.move(Math.floor(left), 
Math.floor(top));
+                                       if (obj.includeInLayout)
+                                               left += obj.width + gap;
+                                       COMPILE::JS {
+                                               obj.element.style.position = 
'absolute';
+                                       }
+                               }
+                       }
+               }
+               
+               
//--------------------------------------------------------------------------
+               //
+               //  Methods
+               //
+               
//--------------------------------------------------------------------------
+               
+               /**
+                *  @private
+                */
+               private function isVertical():Boolean
+               {
+                       return direction != BoxDirection.HORIZONTAL;
+               }
+               
+               /**
+                *  @private
+                */
+               protected function widthPadding(numChildren:Number):Number
+               {
+                       var vm:EdgeMetrics = target.viewMetricsAndPadding;
+                       var padding:Number = vm.left + vm.right;
+                       
+                       if (numChildren > 1 && isVertical() == false)
+                       {
+                               padding += target.getStyle("horizontalGap") *
+                                       (numChildren - 1);
+                       }
+                       
+                       return padding;
+               }
+               
+               /**
+                *  @private
+                */
+               protected function heightPadding(numChildren:Number):Number
+               {
+                       var vm:EdgeMetrics = target.viewMetricsAndPadding;
+                       var padding:Number = vm.top + vm.bottom;
+                       
+                       if (numChildren > 1 && isVertical())
+                       {
+                               padding += target.getStyle("verticalGap") *
+                                       (numChildren - 1);
+                       }
+                       
+                       return padding;
+               }
+               
+               /**
+                *  @private
+                *  Returns a numeric value for the align setting.
+                *  0 = left/top, 0.5 = center, 1 = right/bottom
+                */
+               protected function getHorizontalAlignValue():Number
+               {
+                       var horizontalAlign:String = 
target.getStyle("horizontalAlign");
+                       
+                       if (horizontalAlign == "center")
+                               return 0.5;
+                               
+                       else if (horizontalAlign == "right")
+                               return 1;
+                       
+                       // default = left
+                       return 0;
+               }
+               
+               /**
+                *  @private
+                *  Returns a numeric value for the align setting.
+                *  0 = left/top, 0.5 = center, 1 = right/bottom
+                */
+               protected function getVerticalAlignValue():Number
+               {
+                       var verticalAlign:String = 
target.getStyle("verticalAlign");
+                       
+                       if (verticalAlign == "middle")
+                               return 0.5;
+                               
+                       else if (verticalAlign == "bottom")
+                               return 1;
+                       
+                       // default = top
+                       return 0;
+               }
+       }
+       
+}
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/utilityClasses/Flex.as
 
b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/utilityClasses/Flex.as
new file mode 100644
index 0000000..0796a16
--- /dev/null
+++ 
b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/utilityClasses/Flex.as
@@ -0,0 +1,678 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.containers.utilityClasses
+{
+
+import mx.core.IChildList;
+import mx.core.IUIComponent;
+
+[ExcludeClass]
+
+/**
+ *  @private
+ *  The Flex class is for internal use only.
+ */
+public class Flex
+{
+       
//--------------------------------------------------------------------------
+       //
+       //  Class methods
+       //
+       
//--------------------------------------------------------------------------
+
+       /**
+        *  This function sets the width of each child
+        *  so that the widths add up to spaceForChildren.
+        *  Each child is set to its preferred width
+        *  if its percentWidth is zero.
+        *  If it's percentWidth is a positive number
+        *  the child grows depending on the size of its parent
+        *  The height of each child is set to its preferred height.
+        *  The return value is any extra space that's left over
+        *  after growing all children to their maxWidth.
+        *
+        *  @param parent The parent container of the children.
+        *
+        *  @param spaceForChildren The space that is to be
+        *  distributed across all the children.
+        *
+        *  @param h height for all children.
+        *
+        *  @result Any extra space that's left over
+        *  after growing all children to their maxWidth.
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 9
+        *  @playerversion AIR 1.1
+        *  @productversion Flex 3
+        */
+       public static function flexChildWidthsProportionally(
+                                                               
parent:IChildList,
+                                                               
spaceForChildren:Number,
+                                                               h:Number):Number
+       {
+               var spaceToDistribute:Number = spaceForChildren;
+               var totalPercentWidth:Number = 0;
+               var childInfoArray:Array = [];
+               var childInfo:FlexChildInfo;
+               var child:IUIComponent;
+               var i:int;
+
+               // If the child is flexible, store information about it in the
+               // childInfoArray. For non-flexible children, just set the 
child's
+               // width and height immediately.
+               //
+               // Also calculate the sum of all widthFlexes, and calculate the 
+               // sum of the width of all non-flexible children.
+               var n:int = parent.numChildren;
+               for (i = 0; i < n; i++)
+               {
+                       child = IUIComponent(parent.getChildAt(i));
+
+                       var percentWidth:Number = child.percentWidth;
+                       var percentHeight:Number = child.percentHeight;
+                       var height:Number;
+                       
+                       if (!isNaN(percentHeight) && child.includeInLayout)
+                       {
+                               height = Math.max(child.minHeight,
+                                       Math.min(child.maxHeight,
+                                       ((percentHeight >= 100) ? h : h * 
percentHeight / 100)));
+                       }
+                       else
+                       {
+                               height = child.getExplicitOrMeasuredHeight();
+                       }
+                       
+                       if (!isNaN(percentWidth) && child.includeInLayout)
+                       {
+                               totalPercentWidth += percentWidth;
+
+                               childInfo = new FlexChildInfo();
+                               childInfo.percent = percentWidth;
+                               childInfo.min = child.minWidth;
+                               childInfo.max = child.maxWidth;
+                               childInfo.height = height;
+                               childInfo.child = child;
+                               
+                               childInfoArray.push(childInfo);
+                       }
+                       else
+                       {
+                               var width:Number = 
child.getExplicitOrMeasuredWidth();
+                               // if scaled and zoom is playing, best to let 
the sizes be non-integer
+                               // otherwise the rounding creates an error that 
accumulates in some components like List
+                               if (child.scaleX == 1 && child.scaleY == 1)
+                               {
+                                       child.setActualSize(Math.floor(width),
+                                                                               
Math.floor(height));
+                               }
+                               else
+                               {
+                                       child.setActualSize(width, height);
+                               }
+
+                               if (child.includeInLayout)
+                               {
+                                       // Need to account for the actual child 
width since 
+                                       // setActualSize may trigger a Resize 
effect, which 
+                                       // could change the size of the 
component.
+                                       spaceToDistribute -= child.width;
+                               }
+                       }
+               }
+
+               // Distribute the extra space among the children.
+               if (totalPercentWidth)
+               {
+                       spaceToDistribute = 
flexChildrenProportionally(spaceForChildren,
+                               spaceToDistribute, totalPercentWidth, 
childInfoArray);
+
+                       // Set the widths and heights of the flexible children
+                       n = childInfoArray.length;
+                       for (i = 0; i < n; i++)
+                       {
+                               childInfo = childInfoArray[i];
+                               child = childInfo.child;                        
+
+                               // if scaled and zoom is playing, best to let 
the sizes be non-integer
+                               // otherwise the rounding creates an error that 
accumulates in some components like List
+                               if (child.scaleX == 1 && child.scaleY == 1)
+                               {
+                                       
child.setActualSize(Math.floor(childInfo.size),
+                                                                               
Math.floor(childInfo.height));
+                               }
+                               else
+                               {
+                                       child.setActualSize(childInfo.size, 
childInfo.height);
+                               }
+                       }
+                       
+                       distributeExtraWidth(parent, spaceForChildren);
+               }
+
+               return spaceToDistribute;
+       }
+
+       /**
+        *  This function sets the height of each child
+        *  so that the heights add up to spaceForChildren. 
+        *  Each child is set to its preferred height
+        *  if its percentHeight is zero.
+        *  If its percentHeight is a positive number,
+        *  the child grows (or shrinks) to consume its share of extra space.
+        *  The width of each child is set to its preferred width.
+        *  The return value is any extra space that's left over
+        *  after growing all children to their maxHeight.
+        *
+        *  @param parent The parent container of the children.
+        *
+        *  @param spaceForChildren The space that is to be 
+        *  distributed across all children .
+        *
+        *  @param w width for all children.
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 9
+        *  @playerversion AIR 1.1
+        *  @productversion Flex 3
+        */
+       public static function flexChildHeightsProportionally(
+                                                               
parent:IChildList,
+                                                               
spaceForChildren:Number,
+                                                               w:Number):Number
+       {
+               var spaceToDistribute:Number = spaceForChildren;
+               var totalPercentHeight:Number = 0;
+               var childInfoArray:Array = [];
+               var childInfo:FlexChildInfo;
+               var child:IUIComponent;
+               var i:int;
+
+               // If the child is flexible, store information about it in the
+               // childInfoArray. For non-flexible children, just set the 
child's
+               // width and height immediately.
+               //
+               // Also calculate the sum of all percentHeights, and calculate 
the 
+               // sum of the height of all non-flexible children.
+               var n:int = parent.numChildren;
+               for (i = 0; i < n; i++)
+               {
+                       child = IUIComponent(parent.getChildAt(i));
+
+                       var percentWidth:Number = child.percentWidth;
+                       var percentHeight:Number = child.percentHeight;
+                       var width:Number;
+                       
+                       if (!isNaN(percentWidth) && child.includeInLayout)
+                       {
+                               width = Math.max(child.minWidth,
+                                       Math.min(child.maxWidth,
+                                       ((percentWidth >= 100) ? w : w * 
percentWidth / 100)));
+                       }
+                       else
+                       {
+                               width = child.getExplicitOrMeasuredWidth();
+                       }
+               
+                       if (!isNaN(percentHeight) && child.includeInLayout)
+                       {
+                               totalPercentHeight += percentHeight;
+
+                               childInfo = new FlexChildInfo();
+                               childInfo.percent = percentHeight;
+                               childInfo.min = child.minHeight;
+                               childInfo.max = child.maxHeight;
+                               childInfo.width = width;
+                               childInfo.child = child;
+                               
+                               childInfoArray.push(childInfo);
+                       }
+                       else
+                       {
+                               var height:Number = 
child.getExplicitOrMeasuredHeight();
+                               // if scaled and zoom is playing, best to let 
the sizes be non-integer
+                               // otherwise the rounding creates an error that 
accumulates in some components like List
+                               if (child.scaleX == 1 && child.scaleY == 1)
+                               {
+                                       child.setActualSize(Math.floor(width),
+                                                                               
Math.floor(height));
+                               }
+                               else
+                               {
+                                       child.setActualSize(width, height);
+                               }
+
+                               if (child.includeInLayout)
+                               {
+                                       // Need to account for the actual child 
height since 
+                                       // setActualSize may trigger a Resize 
effect, which 
+                                       // could change the size of the 
component.
+                                       spaceToDistribute -= child.height;
+                               }
+                       }
+               }
+
+               // Distribute the extra space among the children.
+               if (totalPercentHeight)
+               {
+                       spaceToDistribute = 
flexChildrenProportionally(spaceForChildren,
+                               spaceToDistribute, totalPercentHeight, 
childInfoArray);
+
+                       // Set the widths and heights of the flexible children
+                       n = childInfoArray.length;
+                       for (i = 0; i < n; i++)
+                       {
+                               childInfo = childInfoArray[i];
+                               child = childInfo.child;                        
+
+                               // if scaled and zoom is playing, best to let 
the sizes be non-integer
+                               // otherwise the rounding creates an error that 
accumulates in some components like List
+                               if (child.scaleX == 1 && child.scaleY == 1)
+                               {
+                                       
child.setActualSize(Math.floor(childInfo.width),
+                                                                               
Math.floor(childInfo.size));
+                               }
+                               else
+                               {
+                                       child.setActualSize(childInfo.width, 
childInfo.size);
+                               }
+                       }
+                       
+                       distributeExtraHeight(parent, spaceForChildren);
+               }
+               
+               return spaceToDistribute;
+       }
+
+       /**
+        *  This function distributes excess space among the flexible children.
+        *  It does so with a view to keep the children's overall size
+        *  close the ratios specified by their percent.
+        *
+        *  @param spaceForChildren The total space for all children
+        *
+        *  @param spaceToDistribute The space that needs to be distributed
+        *  among the flexible children.
+        *
+        *  @param childInfoArray An array of Objects. When this function
+        *  is called, each object should define the following properties:
+        *  - percent: the percentWidth or percentHeight of the child (depending
+        *  on whether we're growing in a horizontal or vertical direction)
+        *  - min: the minimum width (or height) for that child
+        *  - max: the maximum width (or height) for that child
+        *
+        *  @return When this function finishes executing, a "size" property
+        *  will be defined for each child object. The size property contains
+        *  the portion of the spaceToDistribute to be distributed to the child.
+        *  Ideally, the sum of all size properties is spaceToDistribute.
+        *  If all the children hit their minWidth/maxWidth/minHeight/maxHeight
+        *  before the space was distributed, then the remaining unused space
+        *  is returned. Otherwise, the return value is zero.
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 9
+        *  @playerversion AIR 1.1
+        *  @productversion Flex 3
+        */
+       public static function flexChildrenProportionally(
+                                                               
spaceForChildren:Number,
+                                                               
spaceToDistribute:Number,
+                                                               
totalPercent:Number,
+                                                               
childInfoArray:Array):Number
+       {
+               // The algorithm iterivately attempts to break down the space 
that 
+               // is consumed by "flexible" containers into ratios that are 
related
+               // to the percentWidth/percentHeight of the participating 
containers.
+               
+               var numChildren:int = childInfoArray.length;
+               var flexConsumed:Number; // space consumed by flexible 
compontents
+               var done:Boolean;
+        
+               // Continue as long as there are some remaining flexible 
children.
+               // The "done" flag isn't strictly necessary, except that it 
catches
+               // cases where round-off error causes totalPercent to not 
exactly
+               // equal zero.
+               do
+               {
+                       flexConsumed = 0; // space consumed by flexible 
compontents
+                       done = true; // we are optimistic
+                       
+            // We now do something a little tricky so that we can 
+            // support partial filling of the space. If our total
+            // percent < 100% then we can trim off some space.
+            // This unused space can be used to fulfill mins and maxes.
+            var unused:Number = spaceToDistribute -
+                                (spaceForChildren * totalPercent / 100);
+            if (unused > 0)
+                spaceToDistribute -= unused;
+            else
+                unused = 0;
+            
+                       // Space for flexible children is the total amount of 
space
+                       // available minus the amount of space consumed by 
non-flexible
+                       // components.Divide that space in proportion to the 
percent
+                       // of the child
+                       var spacePerPercent:Number = spaceToDistribute / 
totalPercent;
+                       
+                       // Attempt to divide out the space using our percent 
amounts,
+                       // if we hit its limit then that control becomes 
'non-flexible'
+                       // and we run the whole space to distribute calculation 
again.
+                       for (var i:int = 0; i < numChildren; i++)
+                       {
+                               var childInfo:FlexChildInfo = childInfoArray[i];
+
+                               // Set its size in proportion to its percent.
+                               var size:Number = childInfo.percent * 
spacePerPercent;
+
+                               // If our flexiblity calc say grow/shrink more 
than we are
+                               // allowed, then we grow/shrink whatever we 
can, remove
+                               // ourselves from the array for the next pass, 
and start
+                               // the loop over again so that the space that 
we weren't
+                               // able to consume / release can be re-used by 
others.
+                               if (size < childInfo.min)
+                               {
+                                       var min:Number = childInfo.min;
+                                       childInfo.size = min;
+                                       
+                                       // Move this object to the end of the 
array
+                                       // and decrement the length of the 
array. 
+                                       // This is slightly expensive, but we 
don't expect
+                                       // to hit these min/max limits very 
often.
+                                       childInfoArray[i] = 
childInfoArray[--numChildren];
+                                       childInfoArray[numChildren] = childInfo;
+
+                                       totalPercent -= childInfo.percent;
+                    // Use unused space first before reducing flexible space.
+                    if (unused >= min)
+                    {
+                        unused -= min;
+                    }
+                    else
+                    {
+                        spaceToDistribute -= min - unused;
+                        unused = 0;
+                    }
+                                       done = false;
+                                       break;
+                               }
+                               else if (size > childInfo.max)
+                               {
+                                       var max:Number = childInfo.max;
+                                       childInfo.size = max;
+
+                                       childInfoArray[i] = 
childInfoArray[--numChildren];
+                                       childInfoArray[numChildren] = childInfo;
+
+                                       totalPercent -= childInfo.percent;
+                    // Use unused space first before reducing flexible space.
+                    if (unused >= max)
+                    {
+                        unused -= max;
+                    }
+                    else
+                    {
+                        spaceToDistribute -= max - unused;
+                        unused = 0;
+                    }
+                                       done = false;
+                                       break;
+                               }
+                               else
+                               {
+                                       // All is well, let's carry on...
+                                       childInfo.size = size;
+                                       flexConsumed += size;
+                               }
+                       }
+               } 
+               while (!done);
+
+               return Math.max(0, Math.floor((spaceToDistribute + unused) - 
flexConsumed))
+       }
+       
+       /**
+        *  This function distributes excess space among the flexible children
+        *  because of rounding errors where we want to keep children's 
dimensions 
+        *  full pixel amounts.  This only distributes the extra space 
+        *  if there was some rounding down and there are still 
+        *  flexible children.
+        *
+        *  @param parent The parent container of the children.
+        * 
+        *  @param spaceForChildren The total space for all children
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 9
+        *  @playerversion AIR 1.1
+        *  @productversion Flex 3
+        */
+       public static function distributeExtraHeight(
+                                                               
parent:IChildList,
+                                                               
spaceForChildren:Number):void
+       {
+               // We should only get here after distributing the majority of 
the 
+               // space already.  This is done in 
flexChildHeightsProportionally.
+               // Strategy here is to keep adding 1 pixel at a time to each 
+               // component that's flexible (percentHeight defined and hasn't
+               // reached maxHeight yet).  We could use another approach where
+               // we add more than a pixel at a time, but we'd have to first 
+               // calculate exactly how many flexible components we have first
+               // and see how much space we can add to them without hitting
+               // their maxHeight.  Since we're just dealing with rounding 
+               // issues, we should only make one pass here (if we hit 
maxHeight
+               // problems, we might make more than one, but not many more).
+               
+               // We just distribute from the top-down and don't care about 
+               // who was "rounded down the most"
+               
+               // First check if we should distribute any extra space.  To do 
+               // this, we check to see if someone suffers from rounding error.
+               var n:int = parent.numChildren;
+               var wantToGrow:Boolean = false;
+               var i:int;
+               var percentHeight:Number;
+               var spaceToDistribute:Number = spaceForChildren;
+               var spaceUsed:Number = 0;
+               var child:IUIComponent;
+               var childHeight:Number; 
+               var wantSpace:Number;
+               
+               for (i = 0; i < n; i++)
+               {
+                       child = IUIComponent(parent.getChildAt(i));
+                       
+                       if (!child.includeInLayout)
+                               continue;
+                               
+                       childHeight = child.height;
+                       percentHeight = child.percentHeight;
+                       
+                       spaceUsed += childHeight;
+                       
+                       if (!isNaN(percentHeight))
+                       {
+                               wantSpace = Math.ceil(percentHeight/100 * 
spaceForChildren);
+                               
+                               if (wantSpace > childHeight)
+                                       wantToGrow = true;
+                       }
+               }
+               
+               // No need to distribute extra size
+               if (!wantToGrow)
+                       return;
+
+               // Start distributing...
+               spaceToDistribute -= spaceUsed;
+               
+               // If we still have components that will let us 
+               // distribute to them
+               var stillFlexibleComponents:Boolean = true;     
+               
+               while (stillFlexibleComponents && spaceToDistribute >= 1.0)
+               {
+                       // Start optimistically
+                       stillFlexibleComponents = false;
+                       
+                       for (i = 0; i < n; i++)
+                       {
+                               child = IUIComponent(parent.getChildAt(i));
+                               childHeight = child.height;
+                               percentHeight = child.percentHeight
+                               
+                               // if they have a percentHeight, and we won't 
reach their
+                               // maxHeight by giving them one more pixel, 
then 
+                               // give them a pixel
+                               if (!isNaN(percentHeight) && 
+                                               child.includeInLayout && 
+                                               childHeight < child.maxHeight)
+                               {
+                                       wantSpace = Math.ceil(percentHeight/100 
* spaceForChildren);
+                               
+                                       if (wantSpace > childHeight)
+                                       {
+                                               
child.setActualSize(child.width, childHeight+1);
+                                               spaceToDistribute--;
+                                               stillFlexibleComponents = true;
+                                               
+                                               if (spaceToDistribute == 0)
+                                                       return;
+                                       }
+                               }
+                       }
+               }
+       }
+       
+       /**
+        *  This function distributes excess space among the flexible children
+        *  because of rounding errors where we want to keep children's 
dimensions 
+        *  full pixel amounts.  This only distributes the extra space 
+        *  if there was some rounding down and there are still 
+        *  flexible children.
+        *
+        *  @param parent The parent container of the children.
+        * 
+        *  @param spaceForChildren The total space for all children
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 9
+        *  @playerversion AIR 1.1
+        *  @productversion Flex 3
+        */
+       public static function distributeExtraWidth(
+                                                               
parent:IChildList,
+                                                               
spaceForChildren:Number):void
+       {
+               // We should only get here after distributing the majority of 
the 
+               // space already.  This is done in 
flexChildWidthsProportionally.
+               // Strategy here is to keep adding 1 pixel at a time to each 
+               // component that's flexible (percentWidth defined and hasn't
+               // reached maxWidth yet).  We could use another approach where
+               // we add more than a pixel at a time, but we'd have to first 
+               // calculate exactly how many flexible components we have first
+               // and see how much space we can add to them without hitting
+               // their maxWidth.  Since we're just dealing with rounding 
+               // issues, we should only make one pass here (if we hit maxWidth
+               // problems, we might make more than one, but not many more).
+               
+               // We just distribute from the top-down and don't care about 
+               // who was "rounded down the most"
+               
+               // First check if we should distribute any extra space.  To do 
+               // this, we check to see if someone suffers from rounding error.
+               var n:int = parent.numChildren;
+               var wantToGrow:Boolean = false;
+               var i:int;
+               var percentWidth:Number;
+               var spaceToDistribute:Number = spaceForChildren;
+               var spaceUsed:Number = 0;
+               var child:IUIComponent;
+               var childWidth:Number;  
+               var wantSpace:Number;
+               
+               for (i = 0; i < n; i++)
+               {
+                       child = IUIComponent(parent.getChildAt(i));
+                       
+                       if (!child.includeInLayout)
+                               continue;
+                               
+                       childWidth = child.width;
+                       percentWidth = child.percentWidth;
+                       
+                       spaceUsed += childWidth;
+                       
+                       if (!isNaN(percentWidth))
+                       {
+                               wantSpace = Math.ceil(percentWidth/100 * 
spaceForChildren);
+                               
+                               if (wantSpace > childWidth)
+                                       wantToGrow = true;
+                       }
+               }
+               
+               // No need to distribute extra size
+               if (!wantToGrow)
+                       return;
+
+               // Start distributing...
+               spaceToDistribute -= spaceUsed;
+               
+               // If we still have components that will let us 
+               // distribute to them
+               var stillFlexibleComponents:Boolean = true;     
+               
+               while (stillFlexibleComponents && spaceToDistribute >= 1.0)
+               {
+                       // Start optimistically
+                       stillFlexibleComponents = false;
+                       
+                       for (i = 0; i < n; i++)
+                       {
+                               child = IUIComponent(parent.getChildAt(i));
+                               childWidth = child.width;
+                               percentWidth = child.percentWidth
+                               
+                               // if they have a percentWidth, and we won't 
reach their
+                               // maxWidth by giving them one more pixel, then 
+                               // give them a pixel
+                               if (!isNaN(percentWidth) && 
+                                               child.includeInLayout && 
+                                               childWidth < child.maxWidth)
+                               {
+                                       wantSpace = Math.ceil(percentWidth / 
100 * spaceForChildren);
+                               
+                                       if (wantSpace > childWidth)
+                                       {
+                                               child.setActualSize(childWidth  
+1, child.height);
+                                               spaceToDistribute--;
+                                               stillFlexibleComponents = true;
+                                               
+                                               if (spaceToDistribute == 0)
+                                                       return;
+                                       }
+                               }
+                       }
+               }
+       }
+}
+
+}
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/utilityClasses/FlexChildInfo.as
 
b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/utilityClasses/FlexChildInfo.as
new file mode 100644
index 0000000..72d2911
--- /dev/null
+++ 
b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/utilityClasses/FlexChildInfo.as
@@ -0,0 +1,212 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.containers.utilityClasses
+{
+
+import mx.core.IUIComponent;
+
+[ExcludeClass]
+
+/**
+ *  @private
+ *  Helper class for the Flex.flexChildrenProportionally() method.
+ */
+public class FlexChildInfo
+{
+       
//--------------------------------------------------------------------------
+       //
+       //  Constructor
+       //
+       
//--------------------------------------------------------------------------
+
+       /**
+        *  Constructor.
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 9
+        *  @playerversion AIR 1.1
+        *  @productversion Flex 3
+        */
+       public function FlexChildInfo()
+       {
+               super();
+       }
+       
+       
//--------------------------------------------------------------------------
+       //
+       //  Properties
+       //
+       
//--------------------------------------------------------------------------
+
+       //----------------------------------
+       //  child
+       //----------------------------------
+
+       /**
+        *  @private
+        */
+       private var _child:IUIComponent;
+       public function get child():IUIComponent
+       {
+               return _child;
+       }
+       public function set child(value:IUIComponent):void
+       {
+               _child = value;
+       }
+
+       //----------------------------------
+       //  size
+       //----------------------------------
+
+       /**
+        *  @private
+        */
+       private var _size:Number = 0;
+       public function get size():Number
+       {
+               return _size;
+       }
+       public function set size(value:Number):void
+       {
+               _size = value;
+       }
+
+       //----------------------------------
+       //  preferred
+       //----------------------------------
+
+       /**
+        *  @private
+        */
+       private var _preferred:Number = 0;
+       public function get preferred():Number
+       {
+               return _preferred;
+       }
+       public function set preferred(value:Number):void
+       {
+               _preferred = value;
+       }
+
+       //----------------------------------
+       //  flex
+       //----------------------------------
+
+       /**
+        *  @private
+        */
+       private var _flex:Number = 0;
+       public function get flex():Number
+       {
+               return _flex;
+       }
+       public function set flex(value:Number):void
+       {
+               _flex = value;
+       }
+       
+       //----------------------------------
+       //  percent
+       //----------------------------------
+
+       /**
+        *  @private
+        */
+       private var _percent:Number;
+       public function get percent():Number
+       {
+               return _percent;
+       }
+       public function set percent(value:Number):void
+       {
+               _percent = value;
+       }
+
+       //----------------------------------
+       //  min
+       //----------------------------------
+
+       /**
+        *  @private
+        */
+       private var _min:Number;
+       public function get min():Number
+       {
+               return _min;
+       }
+       public function set min(value:Number):void
+       {
+               _min = value;
+       }
+
+       //----------------------------------
+       //  max
+       //----------------------------------
+
+       /**
+        *  @private
+        */
+       private var _max:Number;
+       public function get max():Number
+       {
+               return _max;
+       }
+       public function set max(value:Number):void
+       {
+               _max = value;
+       }
+
+       //----------------------------------
+       //  width
+       //----------------------------------
+
+       /**
+        *  @private
+        */
+       private var _width:Number;
+       public function get width():Number
+       {
+               return _width;
+       }
+       public function set width(value:Number):void
+       {
+               _width = value;
+       }
+
+       //----------------------------------
+       //  height
+       //----------------------------------
+
+       /**
+        *  @private
+        */
+       private var _height:Number;
+       public function get height():Number
+       {
+               return _height;
+       }
+       public function set height(value:Number):void
+       {
+               _height = value;
+       }
+}
+
+}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as 
b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
index 33f5681..3264c98 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
@@ -27,17 +27,19 @@ package mx.core
        import org.apache.royale.core.ILayoutHost;
        import org.apache.royale.core.ILayoutParent;
        import org.apache.royale.core.ILayoutView;
+       import org.apache.royale.core.IMXMLDocument;
        import org.apache.royale.core.IParent;
        import org.apache.royale.core.IStatesImpl;
        import org.apache.royale.core.IStrandPrivate;
-       import org.apache.royale.core.IMXMLDocument;
        import org.apache.royale.core.ValuesManager;
        import org.apache.royale.events.Event;
        import org.apache.royale.events.ValueChangeEvent;
        import org.apache.royale.events.ValueEvent;
+       import org.apache.royale.geom.Rectangle;
        import org.apache.royale.states.State;
-       import org.apache.royale.utils.loadBeadFromValuesManager;
+       import org.apache.royale.utils.CSSContainerUtils;
        import org.apache.royale.utils.MXMLDataInterpreter;
+       import org.apache.royale.utils.loadBeadFromValuesManager;
 
 COMPILE::JS
 {
@@ -565,6 +567,79 @@ public class Container extends UIComponent
                return view as ILayoutHost;
        }
        
+       //----------------------------------
+       //  getLayoutChildAt for compatibility
+       //----------------------------------
+       
+       public function getLayoutChildAt(index:int):IUIComponent
+       {
+               return getElementAt(index) as IUIComponent;
+       }
+       
+       //----------------------------------
+       //  viewMetricsAndPadding
+       //----------------------------------
+       
+       /**
+        *  @private
+        *  Cached value containing the view metrics plus the object's margins.
+        */
+       private var _viewMetricsAndPadding:EdgeMetrics;
+       
+       /**
+        *  Returns an object that has four properties: <code>left</code>,
+        *  <code>top</code>, <code>right</code>, and <code>bottom</code>.
+        *  The value of each property is equal to the thickness of the chrome
+        *  (visual elements)
+        *  around the edge of the container plus the thickness of the object's 
margins.
+        *
+        *  <p>The chrome includes the border thickness.
+        *  If the <code>horizontalScrollPolicy</code> or 
<code>verticalScrollPolicy</code> 
+        *  property value is <code>ScrollPolicy.ON</code>, the
+        *  chrome also includes the thickness of the corresponding
+        *  scroll bar. If a scroll policy is <code>ScrollPolicy.AUTO</code>,
+        *  the chrome measurement does not include the scroll bar thickness, 
+        *  even if a scroll bar is displayed.</p>
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 9
+        *  @playerversion AIR 1.1
+        *  @productversion Flex 3
+        */
+       public function get viewMetricsAndPadding():EdgeMetrics
+       {               
+               // If this object has scrollbars, and if the 
verticalScrollPolicy
+               // is not ScrollPolicy.ON, then the view metrics change
+               // depending on whether we're doing layout or not.
+               // In that case, we can't use a cached value.
+               // In all other cases, use the cached value if it exists.
+//             if (_viewMetricsAndPadding &&
+//                     (!horizontalScrollBar ||
+//                             horizontalScrollPolicy == ScrollPolicy.ON) &&
+//                     (!verticalScrollBar ||
+//                             verticalScrollPolicy == ScrollPolicy.ON))
+               if (_viewMetricsAndPadding)
+               {
+                       return _viewMetricsAndPadding;
+               }
+               
+               if (!_viewMetricsAndPadding) {
+                       _viewMetricsAndPadding = new EdgeMetrics();
+               }
+               
+               var o:EdgeMetrics = _viewMetricsAndPadding;
+               var vm:EdgeMetrics = new EdgeMetrics();//viewMetrics;
+               var rect:Rectangle = CSSContainerUtils.getBorderMetrics(this);
+               vm.convertFromRectangle(rect);
+               
+               o.left = vm.left + getStyle("paddingLeft");
+               o.right = vm.right + getStyle("paddingRight");
+               o.top = vm.top + getStyle("paddingTop");
+               o.bottom = vm.bottom + getStyle("paddingBottom");
+               
+               return o;
+       }
+       
        
//--------------------------------------------------------------------------
        //  StrandChildren
        
//--------------------------------------------------------------------------
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/core/EdgeMetrics.as 
b/frameworks/projects/MXRoyale/src/main/royale/mx/core/EdgeMetrics.as
new file mode 100644
index 0000000..3ea0ade
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/EdgeMetrics.as
@@ -0,0 +1,241 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.core
+{
+
+import org.apache.royale.geom.Rectangle;
+
+/**
+ *  The EdgeMetrics class specifies the thickness, in pixels,
+ *  of the four edge regions around a visual component.
+ *
+ *  <p>The following Flex properties have values that are EdgeMetrics
+ *  objects:</p>
+ *
+ *  <ul>
+ *  <li>The <code>borderMetrics</code> property of the mx.core.Container and
+ *  mx.skins.Border classes includes only the border in the calculations
+ *  of the property values of the EdgeMetrics object.</li>
+ *
+ *  <li>The <code>viewMetrics</code> property of the mx.core.Container
+ *  class, and of subclasses of the Container class, includes possible
+ *  scrollbars and non-content elements -- such as a Panel container's
+ *  header area and the area for a ControlBar component -- in the calculations
+ *  of the  property values of the EdgeMetrics object.</li>
+ *
+ *  <li>The <code>viewMetricsAndPadding</code> property of the
+ *  mx.core.Container class includes the items listed for the
+ *  <code>viewMetrics</code> property, plus the any areas defined by
+ *  the margins of the container in the calculations of the
+ *  property values of the EdgeMetrics object.</li>
+ *  </ul>
+ *
+ *  <p>These three properites all return a reference to the same
+ *  EdgeMetrics object that the Container is using for its measurement
+ *  and layout; they do not return a copy of this object.
+ *  If you need a copy, call the <code>clone()</code> method.</p>
+ *
+ *  @see mx.core.Container
+ *  @see mx.skins.Border
+ *  @see mx.containers.Panel
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class EdgeMetrics
+{
+    
//--------------------------------------------------------------------------
+    //
+    //  Class constants
+    //
+    
//--------------------------------------------------------------------------
+
+    /**
+     *  An EdgeMetrics object with a value of zero for its
+     *  <code>left</code>, <code>top</code>, <code>right</code>,
+     *  and <code>bottom</code> properties.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
+
+    
//--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    
//--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *  @param left The width, in pixels, of the left edge region.
+     *
+     *  @param top The height, in pixels, of the top edge region.
+     *
+     *  @param right The width, in pixels, of the right edge region.
+     *
+     *  @param bottom The height, in pixels, of the bottom edge region.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function EdgeMetrics(left:Number = 0, top:Number = 0,
+                                right:Number = 0, bottom:Number = 0)
+    {
+        super();
+
+        this.left = left;
+        this.top = top;
+        this.right = right;
+        this.bottom = bottom;
+    }
+
+    public function convertFromRectangle(rect:Rectangle):void
+    {
+       this.left = rect.x;
+       this.top = rect.y;
+       this.right = rect.x + rect.width;
+       this.bottom = rect.y + rect.height;
+    }
+
+    
//--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    
//--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  bottom
+    //----------------------------------
+
+    /**
+     *  The height, in pixels, of the bottom edge region.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private var _bottom:Number;
+       public function get bottom():Number
+       {
+               return _bottom;
+       }
+       public function set bottom(value:Number):void 
+       {
+               _bottom = value;
+       }
+
+    //----------------------------------
+    //  left
+    //----------------------------------
+
+    /**
+     *  The width, in pixels, of the left edge region.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private var _left:Number;
+       public function get left():Number 
+       {
+               return _left;
+       }
+       public function set left(value:Number):void
+       {
+               _left = value;
+       }
+
+    //----------------------------------
+    //  right
+    //----------------------------------
+
+    /**
+     *  The width, in pixels, of the right edge region.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private var _right:Number;
+       public function get right():Number 
+       {
+               return _right;
+       }
+       public function set right(value:Number):void
+       {
+               _right = value;
+       }
+
+    //----------------------------------
+    //  top
+    //----------------------------------
+
+    /**
+     *  The height, in pixels, of the top edge region.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private var _top:Number;
+       public function get top():Number
+       {
+               return _top;
+       }
+       public function set top(value:Number):void
+       {
+               _top = value;
+       }
+
+    
//--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    
//--------------------------------------------------------------------------
+
+    /**
+     *  Returns a copy of this EdgeMetrics object.
+     *
+     *  @return A copy of this EdgeMetrics object.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function clone():EdgeMetrics
+    {
+        return new EdgeMetrics(left, top, right, bottom);
+    }
+}
+
+}
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUIComponent.as 
b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUIComponent.as
index fc2e3ae..7fe75e3 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUIComponent.as
@@ -405,6 +405,12 @@ public interface IUIComponent extends IFlexDisplayObject, 
IChild
      *  @private
      */
     function set percentWidth(value:Number):void;
+       
+       function get scaleX():Number;
+       function set scaleX(value:Number):void;
+       
+       function get scaleY():Number;
+       function set scaleY(value:Number):void;
 
     //----------------------------------
     //  systemManager
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as 
b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index 319d77b..2c595a9 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -48,6 +48,7 @@ import mx.managers.ISystemManager;
 
 import org.apache.royale.core.TextLineMetrics;
 import org.apache.royale.core.UIBase;
+import org.apache.royale.core.ValuesManager;
 import org.apache.royale.events.Event;
 import org.apache.royale.events.KeyboardEvent;
 import org.apache.royale.geom.Point;
@@ -932,6 +933,7 @@ public class UIComponent extends UIBase
      */
     public function get measuredWidth():Number
     {
+               if (_measuredWidth == 0 && width > 0) return width;
         return _measuredWidth;
     }
 
@@ -966,6 +968,7 @@ public class UIComponent extends UIBase
      */
     public function get measuredHeight():Number
     {
+               if (_measuredHeight == 0 && height > 0) return height;
         return _measuredHeight;
     }
 
@@ -1605,6 +1608,30 @@ public class UIComponent extends UIBase
 
         dispatchEvent(new Event("explicitMaxHeightChanged"));
     }
+       
+       COMPILE::JS
+       public function get scaleX():Number
+       {
+               return 1.0;
+       }
+       
+       COMPILE::JS
+       public function set scaleX(value:Number):void
+       {
+               // always 1.0
+       }
+       
+       COMPILE::JS
+       public function get scaleY():Number
+       {
+               return 1.0;
+       }
+       
+       COMPILE::JS
+       public function set scaleY(value:Number):void
+       {
+               // always 1.0
+       }
 
 
     //----------------------------------
@@ -2991,8 +3018,10 @@ public class UIComponent extends UIBase
       */
     public function move(x:Number, y:Number):void
     {
-        if (GOOG::DEBUG)
-            trace("move not implemented");
+        //if (GOOG::DEBUG)
+        //    trace("move not implemented");
+               this.x = x;
+               this.y = y;
     }
 
     /**
@@ -3017,8 +3046,10 @@ public class UIComponent extends UIBase
      */
     public function setActualSize(w:Number, h:Number):void
     {
-        if (GOOG::DEBUG)
-            trace("setActualSize not implemented");
+        //if (GOOG::DEBUG)
+        //    trace("setActualSize not implemented");
+               this.width = w;
+               this.height = h;
     }
 
 
@@ -3085,10 +3116,12 @@ public class UIComponent extends UIBase
      */
     public function getStyle(styleProp:String):*
     {
-        if (GOOG::DEBUG)
-            trace("getStyle not implemented");
-        return 0;
-
+//        if (GOOG::DEBUG)
+//            trace("getStyle not implemented");
+//        return 0;
+               var value:* = ValuesManager.valuesImpl.getValue(this,styleProp);
+               if (!value) value = 0;
+               return value;
     }
 
     /**

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to