1文件结构 MXML应用程序 index.mxml

皮肤文件 components.button.skin.btnSkin1.mxml  皮肤文件的组件随便引用了spark.components.Button

2

index.mxml代码

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600" backgroundColor="#00C955">
<s:layout>
<s:BasicLayout/>
</s:layout> <s:TileGroup x="122" y="53" width="500" height="500" orientation="columns">
<s:Button label="Flex4 一个简单的默认按钮" />
<s:Button label="Flex4 一个简单的按钮皮肤" chromeColor="#ccaacc"
skinClass="components.button.skin.btnSkin1"/>
<s:Button label="Flex4 一个简单的按钮皮肤" chromeColor="haloOrange"
skinClass="components.button.skin.btnSkin1"/>
<s:Button label="Flex4 一个简单的按钮皮肤" chromeColor="yellow"
skinClass="components.button.skin.btnSkin1"/>
<s:Button label="Flex4 一个简单的按钮皮肤" chromeColor="haloGreen"
skinClass="components.button.skin.btnSkin1"/>
<s:Button label="Flex4 一个简单的按钮皮肤" chromeColor="haloBlue"
skinClass="components.button.skin.btnSkin1"/>
<s:Button label="Flex4 一个简单的按钮皮肤" chromeColor="#000000"
skinClass="components.button.skin.btnSkin1"/>
<s:Button label="Flex4 一个简单的按钮皮肤"
skinClass="components.button.skin.btnSkin1"/>
<s:Button label="Flex4 一个简单的按钮皮肤" chromeColor="#ffffff"
skinClass="components.button.skin.btnSkin1"/>
</s:TileGroup> </s:Application>

3

btnSkin1.mxml

<?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="40" minHeight="23"
alpha.disabled="0.5"> <fx:Metadata>
<![CDATA[
[HostComponent("spark.components.Button")]
]]>
</fx:Metadata> <fx:Script>
<![CDATA[
[Bindable]
public var bgColor:uint; protected override function initializationComplete():void
{
bgColor=hostComponent.getStyle("chromeColor");
useChromeColor = false;
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:Rect id="shadow" left="0" right="0" top="0" bottom="0" radiusX="2">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="{bgColor}"
color.down="0xff0033"
alpha.down="0.5" />
<s:GradientEntry color="0xFFFFFF"
color.down="0xff0033"
alpha.down="0.5" />
</s:LinearGradient>
</s:fill>
</s:Rect> <!-- 附件矩形-->
<s:Rect id="fill" left="1" right="1" top="1" bottom="1" radiusX="2">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="0xFFFFFF"
color.over="0xBBBDBD"
color.down="0xff0033"
alpha="0.85" />
<s:GradientEntry color="0xD8D8D8"
color.over="0x9FA0A1"
color.down="0xff0033"
alpha="0.85" />
</s:LinearGradient>
</s:fill>
</s:Rect> <!-- 附件矩形 弱色显示-->
<s:Rect id="lowlight" left="1" right="1" top="1" bottom="1" radiusX="2">
<s:fill>
<s:LinearGradient rotation="270">
<s:GradientEntry color="{bgColor}" alpha="0.0627" />
<s:GradientEntry color="0xFFFFFF" alpha="0" />
</s:LinearGradient>
</s:fill>
</s:Rect> <!-- 附件矩形 高亮显示-->
<s:Rect id="highlight" left="1" right="1" top="1" bottom="1" radiusX="2">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="{bgColor}"
alpha.over="0.22"
alpha.down="0.12"/>
<s:GradientEntry color="0xFFFFFF"/>
</s:LinearGradient>
</s:fill>
</s:Rect> <!-- 附件矩形-->
<s:Rect id="highlightStroke" left="1" right="1" top="1" bottom="1" radiusX="2" excludeFrom="down">
<s:stroke>
<s:LinearGradientStroke rotation="90" weight="1">
<s:GradientEntry color="0xFFFFFF" alpha.over="0.22" />
<s:GradientEntry color="0xD8D8D8" alpha.over="0.22" />
</s:LinearGradientStroke>
</s:stroke>
</s:Rect> <!-- 附件矩形 鼠标按下,高亮显示-->
<s:Rect id="hldownstroke1" left="1" right="1" top="1" bottom="1" radiusX="2" includeIn="down">
<s:stroke>
<s:LinearGradientStroke rotation="90" weight="1">
<s:GradientEntry color="0xff0033" alpha="0.25" ratio="0.0" />
<s:GradientEntry color="0xff0033" alpha="0.25" ratio="0.001" />
<s:GradientEntry color="0xff0033" alpha="0.07" ratio="0.0011" />
<s:GradientEntry color="0xff0033" alpha="0.07" ratio="0.965" />
<s:GradientEntry color="0xff0033" alpha="0.00" ratio="0.9651" />
</s:LinearGradientStroke>
</s:stroke>
</s:Rect>
<s:Rect id="hldownstroke2" left="2" right="2" top="2" bottom="2" radiusX="2" includeIn="down">
<s:stroke>
<s:LinearGradientStroke rotation="90" weight="1">
<s:GradientEntry color="0xff0033" alpha="0.09" ratio="0.0" />
<s:GradientEntry color="0xff0033" alpha="0.00" ratio="0.0001" />
</s:LinearGradientStroke>
</s:stroke>
</s:Rect> <!-- 附件矩形-->
<s:Rect id="border" left="1" right="1" top="1" bottom="1" width="69" height="20" radiusX="2">
<s:stroke>
<s:LinearGradientStroke rotation="90" weight="1">
<s:GradientEntry color="0xFFFFFF"
alpha="0.5625"
alpha.down="0.6375" />
<s:GradientEntry color="0xFFFFFF"
alpha="0.75"
alpha.down="0.85" />
</s:LinearGradientStroke>
</s:stroke>
</s:Rect> <!-- 文本显示 -->
<s:Label id="labelDisplay" text="{hostComponent.label}"
left="12" right="12" top="0" bottom="0" horizontalCenter="0" verticalCenter="0"
maxDisplayedLines="0" textAlign="center" verticalAlign="middle">
</s:Label> </s:SparkButtonSkin>

Flex学习笔记-皮肤的更多相关文章

  1. CSS3伸缩布局Flex学习笔记

    如果需要使用伸缩布局首先得把display:flex;对于兼容还得加前缀display:-webkit-display:flex;等其他浏览器前缀,但我本机Chrome测试已经不需要加前缀了,其实这些 ...

  2. Flex学习笔记-时间触发器

    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...

  3. Flex学习笔记-Vgropu Hgroup 定义的组 表单程序。

    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...

  4. Flex学习笔记-自定义菜单的显示细节

    icon <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx=&qu ...

  5. Flex学习笔记--多层菜单按钮

    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...

  6. Flex学习笔记-使用MXML和一个AS事件监听器监听事件

    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...

  7. flex学习笔记 使用函数,显示实时更新的标签

    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...

  8. Flex学习笔记,脚本式验证

    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...

  9. Flex学习笔记PopUpMenuButton

    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...

随机推荐

  1. C++11--智能指针shared_ptr,weak_ptr,unique_ptr <memory>

    共享指针 shared_ptr /*********** Shared_ptr ***********/ // 为什么要使用智能指针,直接使用裸指针经常会出现以下情况 // 1. 当指针的生命长于所指 ...

  2. C/C++基础----特殊工具和技术 (重载new和delete,RTT,限定作用域的枚举类型,类成员指针,嵌套类,局部类,volatile,链接指示 extern “C”)

    重载new和delete 1调用operator new( 或new[])标准库函数分配足够大的.原始的.未命名的内存空间以便存储特定类型的对象 2编译器运行相应地构造函数以构造这些对象,并为其传入初 ...

  3. 安装包制作工具 SetupFactory 详解

    Setup Factory 是一个强大的安装程序制作工具.提供了安装制作向导界面,即使你对安装制作不了解,也可以生成专业性质的安装程序.可建立快捷方式,也可直接在 Windows 系统的注册表加入内容 ...

  4. stopPropagation()阻止事件的冒泡传递

    <!doctype html><html><head><meta charset="utf-8"><title>无标题文 ...

  5. C语言强化——字符串(2)

    1.将包含字符数字的字符串分开,使得分开后的字符串前一部分是数字后一部分是字母.例 如"h1ell2o3" -> "123hello" #include& ...

  6. 事件之父View和子view的点击事件的执行过程

    Android中的事件类型分为按键事件和屏幕触摸事件,Touch事件是屏幕触摸事件的基础事件,有必要对它进行深入的了解. 一个最简单的屏幕触摸动作触发了一系列Touch事件:ACTION_DOWN-& ...

  7. IE浏览器强制不是要兼容视图

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta ht ...

  8. ACCESS常用数字类型的说明和取值范围

    下面是ACCESS常用数字类型的说明和取值范围列表明供参考 数字类型                 范围 Byte(字节)            介于 0 到 255 之间的整型数. Integer ...

  9. 在Ubuntu16.04下安装 labelImg

    首先按照 http://www.linuxdiyf.com/linux/13934.html 和 http://www.linuxdiyf.com/linux/13934.html  在ubuntu ...

  10. 第6章 静态路由和动态路由(3)_RIP动态路由协议

    5. RIP动态路由协议 5.1 RIP协议(Routing Information Protocol) (1)是一个距离矢量路由选择协议.选择最佳路径的标准是跳数,如果到达目标网络经过的路由器最少, ...