Why doesn't a button with a spark button have an iconDisplay tag by default?

For the Flex 4.6 button, you can define a label and icon:

<s:Button icon="{@Embed('assets/icon.png'}" label="Do the dance" />

Corresponding parts of the skin: iconDisplay:BitmapImageand labelDisplay:IDisplayTextthat are installed by the component ( adobe ref ). They are defined in ButtonBase.as

spark.components.supportClasses.ButtonBase

//--------------------------------------------------------------------------
//
//  Skin parts
//
//--------------------------------------------------------------------------

[SkinPart(required="false")]

/**
 *  A skin part that defines an optional icon for the button. 
 *  
 *  @langversion 3.0
 *  @playerversion Flash 10.1
 *  @playerversion AIR 2.0
 *  @productversion Flex 4.5
 */
public var iconDisplay:BitmapImage;

[SkinPart(required="false")]

/**
 *  A skin part that defines the label of the button. 
 *  
 *  @langversion 3.0
 *  @playerversion Flash 10
 *  @playerversion AIR 1.5
 *  @productversion Flex 4
 */
public var labelDisplay:IDisplayText;

spark.components.Button extends ButtonBase and adds some new styles and the _emphasized property, but doesn't mention anything about iconDisplay. Thus, it seems to me that the only class used to draw the button is the skin class. If we move on to spark.skins.spark.ButtonSkin, which is the default shell used by Flex (or is it?), We will find:

<!-- layer 8: text -->
    <!--- @copy spark.components.supportClasses.ButtonBase#labelDisplay  -->
    <s:Label id="labelDisplay"
             textAlign="center"
             maxDisplayedLines="1"
             horizontalCenter="0" verticalCenter="1" verticalAlign="middle"
             left="10" right="10" top="2" bottom="2">
    </s:Label>

, <s:BitmapImage id="iconDisplay">, , , ?

+4
1

, ButtonSkin extends SparkButtonSkin, iconDisplay, iconGroup constructIconParts(). - mxml ( <s:SparkButtonSkin> root node ButtonSkin.mxml).

FXG : http://hulstkamp.com/articles/flex-advanced-fxg-spark-icon-buttons/

+9

Source: https://habr.com/ru/post/1544886/


All Articles