You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2020/09/26 18:27:32 UTC

[royale-asjs] branch develop updated (7ead936 -> 25b7a5c)

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

yishayw pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git.


    from 7ead936  jewel-datagrid: fix header button alignment
     new d433c71  Adding Power easing function
     new 6845542  Add TitlesWindowBoundsEvent
     new aa2e246  Add SparkButtonSkin
     new 25b7a5c  Merge branch 'develop' of https://github.com/apache/royale-asjs into develop

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/royale/SparkRoyaleClasses.as          |   6 +-
 .../main/royale/spark/components/IconPlacement.as} |  50 +-
 .../supportClasses/LabelAndIconLayout.as           | 527 +++++++++++++++++++++
 .../royale/spark/events/TitleWindowBoundsEvent.as  |   2 +-
 .../src/main/royale/spark/skins/SparkButtonSkin.as |  17 +-
 5 files changed, 573 insertions(+), 29 deletions(-)
 copy frameworks/projects/{MXRoyale/src/main/royale/mx/core/InteractionMode.as => SparkRoyale/src/main/royale/spark/components/IconPlacement.as} (57%)
 create mode 100644 frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/LabelAndIconLayout.as


[royale-asjs] 01/04: Adding Power easing function

Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d433c71ab6bab65d1e8aa1536d6fb10c7290e47d
Author: Yishay Weiss <yi...@yell.com>
AuthorDate: Sat Sep 26 18:52:01 2020 +0100

    Adding Power easing function
---
 frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as b/frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as
index 11ad053..a0c06b9 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as
@@ -112,7 +112,7 @@ import spark.effects.Fade; Fade;
 import spark.effects.Resize; Resize; // needed
 import spark.effects.SetAction; SetAction; // needed
 import spark.effects.easing.IEaser; IEaser;
-//import spark.effects.easing.Power; Power; // needed
+import spark.effects.easing.Power; Power; // needed
 //import spark.events.TitleWindowBoundsEvent; TitleWindowBoundsEvent; // needed
 import spark.filters.ColorMatrixFilter; ColorMatrixFilter;
 import spark.filters.DropShadowFilter; DropShadowFilter;


[royale-asjs] 02/04: Add TitlesWindowBoundsEvent

Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 68455424ed2bd279502e9b72094f4a8ea25a9de0
Author: Yishay Weiss <yi...@yell.com>
AuthorDate: Sat Sep 26 18:59:14 2020 +0100

    Add TitlesWindowBoundsEvent
---
 frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as   | 2 +-
 .../SparkRoyale/src/main/royale/spark/events/TitleWindowBoundsEvent.as  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as b/frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as
index a0c06b9..9855677 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as
@@ -113,7 +113,7 @@ import spark.effects.Resize; Resize; // needed
 import spark.effects.SetAction; SetAction; // needed
 import spark.effects.easing.IEaser; IEaser;
 import spark.effects.easing.Power; Power; // needed
-//import spark.events.TitleWindowBoundsEvent; TitleWindowBoundsEvent; // needed
+import spark.events.TitleWindowBoundsEvent; TitleWindowBoundsEvent; // needed
 import spark.filters.ColorMatrixFilter; ColorMatrixFilter;
 import spark.filters.DropShadowFilter; DropShadowFilter;
 import spark.filters.GlowFilter; GlowFilter;
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/events/TitleWindowBoundsEvent.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/events/TitleWindowBoundsEvent.as
index 87b5c91..f69d649 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/events/TitleWindowBoundsEvent.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/events/TitleWindowBoundsEvent.as
@@ -274,7 +274,7 @@ public class TitleWindowBoundsEvent extends Event
     /**
      *  @private
      */
-    override public function clone():Event
+    override public function cloneEvent():Event
     {
         return new TitleWindowBoundsEvent(type, bubbles, cancelable, beforeBounds, afterBounds);
     }


[royale-asjs] 04/04: Merge branch 'develop' of https://github.com/apache/royale-asjs into develop

Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 25b7a5cdd6df49eeb98087444555ca8835a165d5
Merge: aa2e246 7ead936
Author: Yishay Weiss <yi...@yell.com>
AuthorDate: Sat Sep 26 19:27:09 2020 +0100

    Merge branch 'develop' of https://github.com/apache/royale-asjs into develop

 frameworks/projects/Jewel/src/main/resources/defaults.css         | 3 ---
 frameworks/projects/Jewel/src/main/sass/components/_datagrid.sass | 6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)


[royale-asjs] 03/04: Add SparkButtonSkin

Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit aa2e246637af2dee88dee4d132558bf075003127
Author: Yishay Weiss <yi...@yell.com>
AuthorDate: Sat Sep 26 19:26:33 2020 +0100

    Add SparkButtonSkin
---
 .../src/main/royale/SparkRoyaleClasses.as          |   2 +-
 .../main/royale/spark/components/IconPlacement.as  |  84 ++++
 .../supportClasses/LabelAndIconLayout.as           | 527 +++++++++++++++++++++
 .../src/main/royale/spark/skins/SparkButtonSkin.as |  17 +-
 4 files changed, 621 insertions(+), 9 deletions(-)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as b/frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as
index 9855677..9669a89 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as
@@ -118,7 +118,7 @@ import spark.filters.ColorMatrixFilter; ColorMatrixFilter;
 import spark.filters.DropShadowFilter; DropShadowFilter;
 import spark.filters.GlowFilter; GlowFilter;
 import spark.primitives.Ellipse; Ellipse;
-//import spark.skins.SparkButtonSkin; SparkButtonSkin; // needed
+import spark.skins.SparkButtonSkin; SparkButtonSkin; // needed
 import spark.components.IItemRendererOwner; IItemRendererOwner;
 //import spark.skins.spark.mediaClasses.fullScreen.PlayPauseButtonSkin; PlayPauseButtonSkin;
 //import spark.skins.spark.mediaClasses.fullScreen.ScrubBarSkin; ScrubBarSkin;
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/IconPlacement.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/IconPlacement.as
new file mode 100644
index 0000000..a2216a6
--- /dev/null
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/IconPlacement.as
@@ -0,0 +1,84 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 spark.components
+{
+    
+    /**
+     *  The IconPlacement class defines the constants for the allowed values 
+     *  of the <code>iconPlacement</code>
+     *  style of a Button, CheckBox, RadioButton or ToggleButton.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.5 
+     *  @productversion Flex 4.5
+     */
+    public final class IconPlacement
+    {
+        //include "../core/Version.as";
+        
+        //--------------------------------------------------------------------------
+        //
+        //  Class constants
+        //
+        //--------------------------------------------------------------------------
+        
+        /**
+         *  Specifies that the icon appears below the label.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 2.5 
+         *  @productversion Flex 4.5
+         */
+        public static const BOTTOM:String = "bottom";
+        
+        /**
+         *  Specifies that the icon appears to the left of the label.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 2.5 
+         *  @productversion Flex 4.5
+         */
+        public static const LEFT:String = "left";
+        
+        /**
+         *  Specifies that the icon appears to the right of the label.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 2.5 
+         *  @productversion Flex 4.5
+         */
+        public static const RIGHT:String = "right";
+        
+        /**
+         *  Specifies that the icon appears above the label.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 2.5 
+         *  @productversion Flex 4.5
+         */
+        public static const TOP:String = "top";
+    }
+    
+}
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/LabelAndIconLayout.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/LabelAndIconLayout.as
new file mode 100644
index 0000000..95ea987
--- /dev/null
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/LabelAndIconLayout.as
@@ -0,0 +1,527 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 spark.components.supportClasses
+{
+    
+import mx.core.ILayoutElement;
+
+import spark.components.IconPlacement;
+import spark.components.supportClasses.GroupBase;
+import spark.core.IDisplayText;
+import spark.layouts.supportClasses.LayoutBase;
+import spark.layouts.supportClasses.LayoutElementHelper;
+
+[ExcludeClass]
+
+/**
+ *  Helper layout to layout a label relative to a sibling element.
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4.5
+ */
+public class LabelAndIconLayout extends LayoutBase
+{        
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+    
+    /**
+     *  Constructor.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function LabelAndIconLayout():void
+    {
+        super();
+    }
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+    
+    /**
+     * @private
+     */  
+    private var labelElement:ILayoutElement;
+    
+    /**
+     * @private
+     */  
+    private var iconElement:ILayoutElement;
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+    
+    //----------------------------------
+    //  gap
+    //----------------------------------
+    
+    private var _gap:int = 6;
+    
+    [Inspectable(category="General")]
+    
+    /**
+     *  The horizontal space between layout elements, in pixels.
+     * 
+     *  Note that the gap is only applied between layout elements, so if there's
+     *  just one element, the gap has no effect on the layout.
+     * 
+     *  @default 6
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */    
+    public function get gap():int
+    {
+        return _gap;
+    }
+    
+    /**
+     *  @private
+     */
+    public function set gap(value:int):void
+    {
+        if (_gap == value) 
+            return;
+        
+        _gap = value;
+        invalidateTargetSizeAndDisplayList();
+    }
+    
+    //----------------------------------
+    //  iconPlacement
+    //----------------------------------
+    
+    private var _iconPlacement:String = IconPlacement.LEFT;
+    
+    [Inspectable(category="General")]
+    
+    /**
+     *  Position of icon relative to label.
+     * 
+     *  @default IconPlacement.LEFT
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function get iconPlacement():String
+    {
+        return _iconPlacement;
+    }
+    
+    /**
+     *  @private
+     */
+    public function set iconPlacement(value:String):void
+    {
+        if (_iconPlacement == value)
+            return;
+        
+        _iconPlacement = value;
+        invalidateTargetSizeAndDisplayList();
+    }  
+    
+    //----------------------------------
+    //  paddingLeft
+    //----------------------------------
+    
+    private var _paddingLeft:Number = 0;
+    
+    [Inspectable(category="General")]
+    
+    /**
+     *  Number of pixels between the container's left edge
+     *  and the left edge of the first layout element.
+     * 
+     *  @default 0
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function get paddingLeft():Number
+    {
+        return _paddingLeft;
+    }
+    
+    /**
+     *  @private
+     */
+    public function set paddingLeft(value:Number):void
+    {
+        if (_paddingLeft == value)
+            return;
+        
+        _paddingLeft = value;
+        invalidateTargetSizeAndDisplayList();
+    }    
+    
+    //----------------------------------
+    //  paddingRight
+    //----------------------------------
+    
+    private var _paddingRight:Number = 0;
+    
+    [Inspectable(category="General")]
+    
+    /**
+     *  Number of pixels between the container's right edge
+     *  and the right edge of the last layout element.
+     * 
+     *  @default 0
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function get paddingRight():Number
+    {
+        return _paddingRight;
+    }
+    
+    /**
+     *  @private
+     */
+    public function set paddingRight(value:Number):void
+    {
+        if (_paddingRight == value)
+            return;
+        
+        _paddingRight = value;
+        invalidateTargetSizeAndDisplayList();
+    }    
+    
+    //----------------------------------
+    //  paddingTop
+    //----------------------------------
+    
+    private var _paddingTop:Number = 0;
+    
+    [Inspectable(category="General")]
+    
+    /**
+     *  The minimum number of pixels between the container's top edge and
+     *  the top of all the container's layout elements. 
+     * 
+     *  @default 0
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function get paddingTop():Number
+    {
+        return _paddingTop;
+    }
+    
+    /**
+     *  @private
+     */
+    public function set paddingTop(value:Number):void
+    {
+        if (_paddingTop == value)
+            return;
+        
+        _paddingTop = value;
+        invalidateTargetSizeAndDisplayList();
+    }    
+    
+    //----------------------------------
+    //  paddingBottom
+    //----------------------------------
+    
+    private var _paddingBottom:Number = 0;
+    
+    [Inspectable(category="General")]
+    
+    /**
+     *  The minimum number of pixels between the container's bottom edge and
+     *  the bottom of all the container's layout elements. 
+     * 
+     *  @default 0
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function get paddingBottom():Number
+    {
+        return _paddingBottom;
+    }
+    
+    /**
+     *  @private
+     */
+    public function set paddingBottom(value:Number):void
+    {
+        if (_paddingBottom == value)
+            return;
+        
+        _paddingBottom = value;
+        invalidateTargetSizeAndDisplayList();
+    }
+    
+    //--------------------------------------------------------------------------
+    //
+    //  LayoutBase methods
+    //
+    //--------------------------------------------------------------------------
+    
+    /**
+     *  @private 
+     */
+    override public function measure():void
+    {
+        super.measure();
+        
+        var layoutTarget:GroupBase = target;
+        if (!layoutTarget)
+            return;
+        
+        var width:Number = _paddingLeft + _paddingRight;
+        var height:Number = _paddingTop + _paddingBottom;
+
+        var horizontal:Boolean = 
+            iconPlacement == IconPlacement.LEFT ||
+            iconPlacement == IconPlacement.RIGHT;
+
+        assignLayoutElements();
+        
+        var iconHeight:Number = iconElement ? iconElement.getPreferredBoundsHeight() : 0;
+        var iconWidth:Number = iconElement ? iconElement.getPreferredBoundsWidth() : 0;
+        
+        var labelWidth:Number = labelElement && IDisplayText(labelElement).text ? 
+            labelElement.getPreferredBoundsWidth() : 0;
+        var labelHeight:Number = labelElement && IDisplayText(labelElement).text ? 
+            labelElement.getPreferredBoundsHeight() : 0;
+        
+        if (horizontal)
+        {
+            width += labelWidth + iconWidth;
+            if (labelWidth && iconWidth)
+                width += _gap;
+            height += Math.max(labelHeight, iconHeight);
+        }
+        else
+        {
+            width += Math.max(labelWidth, iconWidth);
+            height += labelHeight + iconHeight;
+            if (labelHeight && iconHeight)
+                height += _gap;
+        }
+        
+        layoutTarget.measuredWidth = Math.ceil(width);
+        layoutTarget.measuredHeight = Math.ceil(height);
+    }
+        
+    /**
+     *  @private 
+     */
+    override public function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
+    {
+        super.updateDisplayList(unscaledWidth, unscaledHeight);
+        
+        var layoutTarget:GroupBase = target;
+        if (!layoutTarget)
+            return;
+        
+        var width:Number = _paddingLeft + _paddingRight;
+        var height:Number = _paddingTop + _paddingBottom;
+        
+        var gap:Number;
+        
+        var horizontal:Boolean = 
+            iconPlacement == IconPlacement.LEFT ||
+            iconPlacement == IconPlacement.RIGHT;
+
+        assignLayoutElements();
+        
+        var iconHeight:Number = iconElement ? iconElement.getPreferredBoundsHeight() : 0;
+        var iconWidth:Number = iconElement ? iconElement.getPreferredBoundsWidth() : 0;
+        
+        var validLabel:Boolean = labelElement && IDisplayText(labelElement).text;
+        
+        var labelWidth:Number = validLabel ?  labelElement.getPreferredBoundsWidth() : 0;
+        var labelHeight:Number = validLabel ? labelElement.getPreferredBoundsHeight() : 0;
+        var labelVerticalCenter:Number = validLabel ? 
+            LayoutElementHelper.parseConstraintValue(labelElement.verticalCenter) : 0;
+        
+        var labelX:Number = 0;
+        var labelY:Number = 0;
+        var iconX:Number = 0;
+        var iconY:Number = 0;
+        
+        var viewWidth:Number = unscaledWidth - _paddingLeft - _paddingRight;
+        var viewHeight:Number = unscaledHeight - _paddingTop - _paddingBottom;
+        
+        if (horizontal)
+        {
+           gap = (iconWidth && labelWidth) ? _gap : 0;
+           
+           if (labelWidth > 0)
+           {
+               labelWidth = Math.max(Math.min(viewWidth - iconWidth - gap, labelWidth), 0);
+           }
+           labelHeight = Math.min(unscaledHeight, labelHeight);
+           
+           labelX = ((viewWidth - labelWidth - iconWidth - gap) / 2) + paddingLeft;
+           
+           if (iconPlacement == IconPlacement.LEFT)
+           {
+               labelX += iconWidth + gap;
+               iconX = labelX - (iconWidth + gap);
+           }
+           else
+           {
+               iconX = labelX + labelWidth + gap;
+           }
+           
+           // Collapse padding as necessary if we're lacking the space.
+           if ((_paddingLeft + _paddingRight + iconWidth) > unscaledWidth)
+               iconX = (unscaledWidth/2 - iconWidth/2);
+           
+           iconY = ((viewHeight - iconHeight)/2) + _paddingTop;
+           labelY = ((viewHeight - labelHeight)/2) + 
+               _paddingTop + labelVerticalCenter;
+        }
+        else
+        {
+            gap = (iconHeight && labelHeight) ? _gap : 0;
+            
+            if (labelWidth > 0)
+            {
+                labelWidth = Math.max(viewWidth, 0);
+                labelHeight = Math.min(viewHeight - iconHeight - gap, labelHeight);
+            }
+            
+            labelX = _paddingLeft;
+            iconX += ((viewWidth - iconWidth) / 2) + _paddingLeft;
+            
+            if (iconPlacement == IconPlacement.BOTTOM)
+            {
+                labelY += ((viewHeight - labelHeight - iconHeight - gap)/2) + 
+                    labelVerticalCenter + _paddingTop;
+                iconY += labelY + labelHeight + gap;
+            }
+            else
+            {
+                iconY = ((viewHeight - labelHeight- iconHeight - gap)/2) + _paddingTop;
+                labelY += iconY + iconHeight + gap + labelVerticalCenter;
+            }
+            
+            // Collapse padding as necessary if we're lacking the space.
+            if ((_paddingTop + _paddingBottom + iconHeight) > unscaledHeight)
+                iconY = (unscaledHeight/2 - iconHeight/2);
+
+        }
+
+        if (labelElement)
+        {
+            labelElement.setLayoutBoundsSize(labelWidth, labelHeight);
+            labelElement.setLayoutBoundsPosition(Math.ceil(labelX), Math.ceil(labelY));
+        }
+        
+        if (iconElement)
+        {
+            iconElement.setLayoutBoundsSize(iconWidth, iconHeight);
+            iconElement.setLayoutBoundsPosition(Math.ceil(iconX), Math.ceil(iconY));
+        }
+
+        // Make sure that if the content spans partially over a pixel to the right/bottom,
+        // the content size includes the whole pixel.
+        layoutTarget.setContentSize(
+            Math.ceil(Math.max(unscaledWidth, Math.max(iconWidth, labelWidth))), 
+            Math.ceil(Math.max(unscaledHeight, Math.max(iconHeight, labelHeight)))
+            );
+    }
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+    
+    /**
+     *  @private 
+     *  Convenience function for subclasses that invalidates the
+     *  target's size and displayList so that both layout's <code>measure()</code>
+     *  and <code>updateDisplayList</code> methods get called.
+     * 
+     *  <p>Typically a layout invalidates the target's size and display list so that
+     *  it gets a chance to recalculate the target's default size and also size and
+     *  position the target's elements. For example changing the <code>gap</code>
+     *  property on a <code>VerticalLayout</code> will internally call this method
+     *  to ensure that the elements are re-arranged with the new setting and the
+     *  target's default size is recomputed.</p> 
+     */
+    private function invalidateTargetSizeAndDisplayList():void
+    {
+        var g:GroupBase = target;
+        if (!g)
+            return;
+        
+        g.invalidateSize();
+        g.invalidateDisplayList();
+    }
+    
+    /**
+     *  @private 
+     *  Determine which is our label and which is its sibling.
+     *  Technically we're expecting at most two elements here
+     *  but its not fatal if there are more, though one may obtain 
+     *  unexpected results. 
+     */ 
+    private function assignLayoutElements():void
+    {
+        for (var i:int = 0; i < target.numElements; i++)
+        {
+            var layoutElement:ILayoutElement = target.getElementAt(i) as ILayoutElement;
+            if (!layoutElement || !layoutElement.includeInLayout)
+                continue;
+            
+            if (layoutElement is IDisplayText)
+                labelElement = layoutElement;
+            else
+                iconElement = layoutElement;
+        }
+    }
+}
+    
+}
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/skins/SparkButtonSkin.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/skins/SparkButtonSkin.as
index a3a8115..3ee2a10 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/skins/SparkButtonSkin.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/skins/SparkButtonSkin.as
@@ -22,6 +22,7 @@ package spark.skins
     import mx.core.IVisualElement;
     import mx.styles.IStyleClient;
     
+    import org.apache.royale.core.IChild;
     import spark.components.Group;
     import spark.components.IconPlacement;
     import spark.components.supportClasses.ButtonBase;
@@ -461,30 +462,30 @@ package spark.skins
                     iconGroup.layout = new LabelAndIconLayout();
                 }
                 
-                iconGroup.addElement(iconDisplay);
+                iconGroup.addElement(iconDisplay as IChild);
                 
                 iconGroup.clipAndEnableScrolling = true;
                 addElement(iconGroup);
                 
                 if (labelDisplay && IVisualElement(labelDisplay).parent != iconGroup)
                 {
-                    iconGroup.addElement(IVisualElement(labelDisplay));
+                    iconGroup.addElement(IChild(labelDisplay));
                     if (labelDisplay is IStyleClient)
                         prevTextAlign = IStyleClient(labelDisplay).getStyle("textAlign");
                 }
             }
             else
             {
-                if (iconDisplay && iconDisplay.parent)
-                    iconGroup.removeElement(iconDisplay);
+                if (iconDisplay && (iconDisplay as IChild).parent)
+                    iconGroup.removeElement(iconDisplay as IChild);
                 
                 if (iconGroup && iconGroup.parent)
                 {
                     removeElement(iconGroup);
-                    addElement(IVisualElement(labelDisplay));
+                    addElement(IChild(labelDisplay));
                     
-                    if (labelDisplay is IStyleClient)
-                        IStyleClient(labelDisplay).setStyle("textAlign", prevTextAlign);
+                    //if (labelDisplay is IStyleClient)
+                        //IStyleClient(labelDisplay).setStyle("textAlign", prevTextAlign);
                 }
             }
         }
@@ -502,7 +503,7 @@ package spark.skins
                     iconPlacement == IconPlacement.LEFT ||
                     iconPlacement == IconPlacement.RIGHT ? "start" : "center"
                 
-                IStyleClient(labelDisplay).setStyle("textAlign", alignment);
+                //IStyleClient(labelDisplay).setStyle("textAlign", alignment);
             }
         }