简体   繁体   English

皮肤火花闪光按钮

[英]skin spark flash button

I tried to change classic spark button image with my own custom image. 我试图用自己的自定义图像更改经典的火花按钮图像。 For this I used skinsClass property of the button. 为此,我使用了按钮的skinsClass属性。 My problem is when I click on the button for a short time my image appears and deappears an then the action for the button is executed. 我的问题是,当我短时单击按钮时,我的图像出现并消失,然后执行按钮的操作。 I want to achive something like a static image click. 我想实现静态图片点击之类的功能。

This is the code for the button: 这是按钮的代码:

var button:Button = new Button();   
button.setStyle('skinClass', skins.ImageButtonSkin);

This is the code for the skin class: 这是皮肤类的代码:

<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark"
        minWidth="48" minHeight="48"
        alpha.up="1"
        alpha.down="0">
    <!-- host component -->
    <fx:Metadata>
        [HostComponent("spark.components.Button")]
    </fx:Metadata>

    <!-- states -->
    <s:states>
        <s:State name="disabled" />
        <s:State name="down"  />
        <s:State name="over" />
        <s:State name="up" />
    </s:states>

    <s:BitmapImage source="../assets/gift-icon.png" includeIn="down"/>
    <s:BitmapImage source="../assets/gift-icon.png" includeIn="up"/>
    <s:BitmapImage source="../assets/gift-icon.png" includeIn="over"/>
    <s:BitmapImage source="../assets/gift-icon.png" includeIn="disabled"/>
    <!-- SkinParts
    name=iconDisplay, type=spark.primitives.BitmapImage, required=false
    name=labelDisplay, type=spark.core.IDisplayText, required=false
    -->
</s:Skin>

为了克服这个问题,我使用了s:Button而不是s:Image,其属性为buttonMode =“ true”

alpha.down =“ 0”-> alpha.down =“ 1”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM