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. nginx 隐藏 index.php

    使用情景如下: 在访问 http://php.cc/Att/AttList 的时候.跳转到 http://php.cc/index.php/Att/AttList : 也就是开启重写功能: 在ngin ...

  2. BlueZone automation note1

    To run the patch test cases in C:\sliData\TAF\bzw\test-packs\run_jobs via run_example_tests_smoke_te ...

  3. LeetCode——150. Evaluate Reverse Polish Notation

    一.题目链接:https://leetcode.com/problems/evaluate-reverse-polish-notation/ 二.题目大意: 给定后缀表达式,求出该表达式的计算结果. ...

  4. Android开发之五大布局篇

    一.Android中常用的5大布局方式有以下几种: 线性布局(LinearLayout):按照垂直或者水平方向布局的组件. 相对布局(RelativeLayout):相对其它组件的布局方式. 绝对布局 ...

  5. vue2.0变化

    之前有很多的vue知识总结都是围绕1.0版本实现的,下面主要总结一下2.0相对于1.0的一些变化. 组件定义 在vue1.0中,我们有使用vue.extend()来创建组件构造器继而创建组件实例,如下 ...

  6. Spring MVC 原理图

    SpringMVC的工作原理图: SpringMVC流程 1.  用户发送请求至前端控制器DispatcherServlet. 2.  DispatcherServlet收到请求调用HandlerMa ...

  7. IFE2017笔记

    1. jQuery.trim()方法 jQuery 杂项方法 实例 删除字符串开始和末尾的空格 2.jQuery的map方法可以批量操作数组中元素,可以替代传统在循环中处理完数据挨个push进数据的代 ...

  8. springmvc使用步骤

    1.导包 2.在web.xml文件中配置前端控制器dispatchServlet 3.创建springmvc配置文件springmvc.xml 4.编写controller 5.在springmvc中 ...

  9. 关于easyUI异步获取数据格式问题

    后台向easyUI一般写String类型的数据 成功之后的回调函数中:应将数据转为json格式    $.parsonJSON success:function(result){            ...

  10. 使用Mongo dump 将数据导入到hive

    概述:使用dump 方式将mongo数据导出,上传到hdfs,然后在hive中建立外部表. 1.     使用mongodump 将集合导出 mongodump --host=localhost:27 ...