Adobe Flex 4 学习使用skin class外观应用程序

<!-- -->
  您使用样式和外观自定义应用程序的外观。Flex 4 框架包含两套组件:原来的 MX 组件(可以通过设置样式进行自定义)以及新的 Spark 组件(可通过创建自定义外观进行自定义,这些外观定义组件的外观和布局,然后使用样式将外观与组件关联在一起)。通常使用 MXML 创建 Spark 外观,并使用图形标签绘制图形元素。图形代码可以由程序员编写,或由设计人员使用 Adobe Photoshop CS5、Adobe Illustrator CS5 或 Adobe Fireworks CS5 软件生成。
 
以下是一个应用程序的代码,它创建并使用一个自定义组件外观:
Main.mxml
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:Label text="Standard Button" x="10" y="11"/>
<s:Button label="Label" x="122" y="5"/>
<s:Label text="Skinned Button" x="10" y="40"/>
<s:Button skinClass="com.adobe.samples.skins.PlusButtonSkin" x="122" y="34"/> 
</s:Application>
 
PlusButtonSkin.mxml (/com/adobe/samples/skins/)
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:s="library://ns.adobe.com/flex/spark" >
<fx:Metadata>
[HostComponent("spark.components.Button")]
</fx:Metadata>
<s:states>
<s:State name="disabled" />
<s:State name="down" />
<s:State name="over" />
<s:State name="up" />
</s:states>
<s:Path winding="evenOdd" data="M 2 13 C 2 7 7 2 13 2 C 18 2 23 7 23 13 C 23 18 18 23 13 23 C 7 23 2 18 2 13 Z " >
<s:fill>
<s:SolidColor color="#bfb59f" alpha="1"/>
</s:fill>
<s:stroke>
<s:SolidColorStroke color="#403029" weight="3"/>
</s:stroke>
</s:Path>
<s:Path winding="evenOdd" data="M 13 6 L 13 18">
<s:stroke>
<s:SolidColorStroke color="#403029" weight="2"/>
</s:stroke>
</s:Path>
<s:Path winding="evenOdd" data="M 7 12 L 19 12">
<s:stroke>
<s:SolidColorStroke color="#403029" weight="2"/>
</s:stroke>
</s:Path>
</s:Skin>
 
运行结果:
 
查看完整例子请下载“skinClass_sample”。详细代码说明 请看这里
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值