1 Reply Latest reply on Dec 18, 2011 12:43 AM by drkstr_1

    Extend MXML Skin Class

    MatteoLegittimo Level 1

      Hi,

      i have this skin class for my button:

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009"

                   xmlns:s="library://ns.adobe.com/flex/spark"

                   xmlns:mx="library://ns.adobe.com/flex/mx"

                  alpha.disabled="0.5" width="175" height="30">

          <fx:Metadata>

              [HostComponent("spark.components.Button")]

          </fx:Metadata>

      <fx:Script>

          <![CDATA[

              [Bindable]

              private var backgroundColorOver:int= 0xFFFFFF;

              [Bindable]

              private var textColorOver:int= 0xAAA9A9;

          ]]>

      </fx:Script>

          <fx:Declarations>

              <s:SolidColor id="fillColor"/>

              <s:SolidColorStroke id="strokeColor" color="0xAAA9A9"/>

          </fx:Declarations>

          <s:states>

              <s:State name="up"/>

              <s:State name="over" stateGroups="overButton"/>

              <s:State name="down" stateGroups="overButton"/>

              <s:State name="disabled"/>

          </s:states>

          <s:Rect width="100%" height="100%">

              <s:stroke>

                  <s:SolidColorStroke color="0xAAA9A9" weight="1" joints="miter"/>

              </s:stroke>

              <s:fill>

                  <s:SolidColor color="0xAAA9A9" color.overButton="{backgroundColorOver}"/>

              </s:fill>

          </s:Rect>

          <s:Label id="labelDisplay" color="0xFFFFFF" color.overButton="{textColorOver}"

                   width="100%" height="100%" textAlign="center" verticalAlign="middle" fontSize="14" fontFamily="Helvetica"/>

      </s:SparkSkin>

       

      Instead to  duplicate for onther button which have the background and the enabled state different, i whould like to know hou can override this class.

      Thanks a lot.

        • 1. Re: Extend MXML Skin Class
          drkstr_1 Level 4

          MXML can be extended, but not in a way that would be help in this regards. Most of the useful MXML is assigned to mxmlContent, and this would all be overridden in the extension with an all-or-nothing type of deal.

           

          What you can do is implement custom styles to give you the desired customization, or just rewrite the MXML (all said and done, the later is probably the quickest).