1

独自のカスタム イメージでクラシック スパーク ボタンのイメージを変更しようとしました。このために、ボタンの skinsClass プロパティを使用しました。私の問題は、ボタンを短時間クリックすると、画像が表示されて消え、ボタンのアクションが実行されることです。静止画像のクリックのようなものを実現したい。

ボタンのコードは次のとおりです。

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

これはスキン クラスのコードです。

<?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>
4

2 に答える 2

1

この問題を克服するために、s:Button の代わりにプロパティ buttonMode="true" を持つ s:Image を使用しました

于 2012-11-24T14:02:37.033 に答える
0

alpha.down="0" -> alpha.down="1"

于 2014-04-15T10:41:41.410 に答える