yishayw commented on issue #1062:
URL: https://github.com/apache/royale-asjs/issues/1062#issuecomment-766110149


   SinnbalbleContainer is implemented but not SkinnableComponent. So button 
skinning would not work. In the app I am currently porting I have created 
buttons based on the skin mxml to emulate the look and feel. Here's an example
   
   ```
   <?xml version="1.0" encoding="utf-8"?>
   <s:Group
        xmlns:fx="http://ns.adobe.com/mxml/2009";
        xmlns:s="library://ns.apache.org/royale/spark"
        alpha.disabled="0.5"
        useHandCursor="true"
        buttonMode="true"
        top="0"
        left="0"
        bottom="0"
        right="0"
        creationComplete="onCreationCompleted(event)"
        >
        <fx:Script>
                <![CDATA[
                        import mx.events.FlexEvent;
   
                        [Bindable]
                        private var customFontSize : Number = 11;
   
                        protected function 
onCreationCompleted(event:FlexEvent):void
                        {
                                var parentFontStyle : Number =  
getStyle("fontSize");
                                customFontSize = (parentFontStyle) ? 
parentFontStyle :customFontSize;
                                if (_labelPending)
                                {
                                        labelDisplay.text = _label;
                                        if (parent)
                                                (parent as 
IEventDispatcher).dispatchEvent(new Event("layoutNeeded"));                  
                                }
                                
addEventListener(mx.events.MouseEvent.MOUSE_DOWN, mouseHandler);
                        }
   
                        private function 
mouseHandler(event:mx.events.MouseEvent):void
                        {
                                currentState = event.type == !enabled ? 
'disabled' :
                                        mx.events.MouseEvent.MOUSE_DOWN ? 
"down" :
                                        event.type == 
mx.events.MouseEvent.MOUSE_UP ? "up" :
                                        event.type == 
mx.events.MouseEvent.ROLL_OVER ? "over" : "normal";
                        }
   
                        private var _labelPending:Boolean;
                        private var _label:String;
                        public function set label(value:String):void
                        {
                                _label = value;
                                if (!labelDisplay)
                                {
                                        _labelPending = true;
                                } else
                                {
                                        labelDisplay.text = value;
                                        if (parent)
                                                (parent as 
IEventDispatcher).dispatchEvent(new Event("layoutNeeded"));                  
                                }
                        }
   
                        /**
                         *  @private
                         */
                        public function get label():String          
                        {
                                return _label;
                        }
                ]]>
        </fx:Script>
   
        <s:states>
                <s:State name="up" />
                <s:State name="over" />
                <s:State name="down" />
                <s:State name="disabled" />
        </s:states>
        <s:layout>
                <s:VerticalLayout verticalAlign="middle" paddingTop="4" />
        </s:layout>
        <!-- label -->
   
        <s:Label
                id="labelDisplay"
                fontSize="{customFontSize}"
                fontFamily="SMhelveticaCFF"
                text=""
                color="0xffffff"
                color.over="0x92cdcf"
                textDecoration="none"
                textDecoration.over="none"
                verticalCenter="-5"
                baselineShift="{2}"
                />
   </s:Group>
   
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to