flex4 skin image

flex4 skin 使用外部图片,当需要自定义一个组件时,需要用到一些外部图片,对于一些flex3的遗留思想,

希望通过css来控制,

upSkin="{null}"

overSkin="mx.skins.halo.ButtonSkin"

downSkin="mx.skins.halo.ButtonSkin"

disabledSkin="mx.skins.halo.ButtonSkin"

 

 在flex4中,对于 spark 组件就不行了

flex4 创建css 就不多介绍了

现以button引入外部image (常用*.png,*.swf中图片)为例:

<?xml version="1.0" encoding="utf-8"?>
<s:SparkButtonSkin xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:fb="http://ns.adobe.com/flashbuilder/2009"
			   minWidth="21" minHeight="21" 
			   alpha.disabled="0.5">

<fx:Metadata>
	<![CDATA[ 
	/** 
	* @copy spark.skins.spark.ApplicationSkin#hostComponent
	*/
	[HostComponent("spark.components.Button")]
	]]>
</fx:Metadata>

<fx:Script fb:purpose="styling">
	<![CDATA[         
		import spark.components.Group;
		/* Define the skin elements that should not be colorized. 
		For button, the graphics are colorized but the label is not. */
		static private const exclusions:Array = ["labelDisplay"];
		
		/** 
		 * @private
		 */     
		override public function get colorizeExclusions():Array {return exclusions;}
		
		/**
		 * @private
		 */
		override protected function initializationComplete():void
		{
			useChromeColor = true;
			super.initializationComplete();
		}  
		
	]]>        
</fx:Script>
<s:states>  
<s:State name="up"/>  
<s:State name="over"/>  
<s:State name="down"/>  
<s:State name="disabled"/>  
</s:states>  
<s:BitmapImage smooth="true" 
source="@Embed('button-up.png')" 
source.up="@Embed('button-up.png')" 
source.down="@Embed('button-down.png')" 
source.disabled="@Embed('button-disabled.png')" 
/>  
<s:Image smooth="true" source="@Embed(source='MyButton.swf',symbol='pBtnUp')" />
<s:Label id="labelDisplay" />
</s:SparkButtonSkin> 

   

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值