Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 在Flex 4中为按钮蒙皮的图像_Actionscript 3_Apache Flex_Flex4 - Fatal编程技术网

Actionscript 3 在Flex 4中为按钮蒙皮的图像

Actionscript 3 在Flex 4中为按钮蒙皮的图像,actionscript-3,apache-flex,flex4,Actionscript 3,Apache Flex,Flex4,我正在尝试用图像给按钮蒙皮 以下代码适用于Flex3,但我需要Flex4代码中的等效代码。 不使用皮肤类 .muteVolumeButton { upSkin: Embed(source='images/sound-mute.gif'); overSkin:Embed(source='images/sound-hover.gif'); downSkin: Embed(source='images/sound-on.gif'); disabledSkin: Em

我正在尝试用图像给按钮蒙皮

以下代码适用于Flex3,但我需要Flex4代码中的等效代码。 不使用皮肤类

.muteVolumeButton 
{
  upSkin: Embed(source='images/sound-mute.gif');   
  overSkin:Embed(source='images/sound-hover.gif');   
  downSkin: Embed(source='images/sound-on.gif');   
  disabledSkin: Embed(source='images/sound-mute.gif');
}

请发布Flex4代码。

我应该说Spark框架中的蒙皮与Halo方式有点不同

最好的描述是。这是解决你问题的最好最简单的方法。 以下是代码:

components.ImageButton.as

脚本:

MXML部分:


在所有其他情况下,您始终可以通过CSS对状态进行蒙皮

  • 您应该始终放置您的皮肤:
    @namespace s”library://ns.adobe.com/flex/spark";
  • 您可以访问组件状态:
    s|按钮:down
  • 您可以使用图像扩展您的皮肤,并通过CSS覆盖它,但它不是一个核心组件
  • 以下是一些有用的链接:


    在皮肤中打开脚本标记并执行以下操作:

            [Embed(source="assets/images/button-up.png", scaleGridLeft = "4", scaleGridRight = "5", scaleGridTop = "2", scaleGridBottom = "3")]
            [Bindable]
            public var upImg:Class; 
    
    
            [Embed(source="assets/images/button-over.png", scaleGridLeft = "4", scaleGridRight = "5", scaleGridTop = "4", scaleGridBottom = "5")]
            [Bindable]
            public var overImg:Class;
    
            [Embed(source="assets/images/button-disabled-skin.png", scaleGridLeft = "4", scaleGridRight = "5", scaleGridTop = "2", scaleGridBottom = "3")]
            [Bindable]
            public var disabledImg:Class;
    
            [Embed(source="assets/images/button-over.png", scaleGridLeft = "4", scaleGridRight = "5", scaleGridTop = "4", scaleGridBottom = "5")]
            [Bindable]
            public var downImg:Class;
    
    删除所有默认填充,改为使用:

    <s:BitmapImage source="{upImg}"
                   source.over="{overImg}"
                   source.down="{downImg}"
                   source.disabled="{disabledImg}"
                   width="100%"/>
    
    
    

    瞧,谢谢你提供的信息。但是为什么adobe在flex4中删除了最简单的通过css对按钮进行Flex3图像蒙皮的功能呢?我面临的困难是用不同的图像对多个按钮进行蒙皮。在spark框架中,更灵活的方法是用图像扩展按钮,然后通过css进行设置。比如+1给尤金一个好答案。是的,您必须通过皮肤来实现这一点,但好消息是,您可以创建一次通用皮肤,然后通过在CSS中设置图像将其用于任何按钮,就像您在Flex 3中所做的那样。
    <components:ImageButton buttonMode="true"  
       imageSkin="{btnGo}" imageSkinDisabled="{btnGoDisabled}"  
       imageSkinDown="{btnGoOver}" imageSkinOver="{btnGoOver}"  
       skinClass="assets.skins.ImageButtonSkin"/>  
    
            [Embed(source="assets/images/button-up.png", scaleGridLeft = "4", scaleGridRight = "5", scaleGridTop = "2", scaleGridBottom = "3")]
            [Bindable]
            public var upImg:Class; 
    
    
            [Embed(source="assets/images/button-over.png", scaleGridLeft = "4", scaleGridRight = "5", scaleGridTop = "4", scaleGridBottom = "5")]
            [Bindable]
            public var overImg:Class;
    
            [Embed(source="assets/images/button-disabled-skin.png", scaleGridLeft = "4", scaleGridRight = "5", scaleGridTop = "2", scaleGridBottom = "3")]
            [Bindable]
            public var disabledImg:Class;
    
            [Embed(source="assets/images/button-over.png", scaleGridLeft = "4", scaleGridRight = "5", scaleGridTop = "4", scaleGridBottom = "5")]
            [Bindable]
            public var downImg:Class;
    
    <s:BitmapImage source="{upImg}"
                   source.over="{overImg}"
                   source.down="{downImg}"
                   source.disabled="{disabledImg}"
                   width="100%"/>