日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

flex中自定义皮肤的按钮制作

發布時間:2024/4/17 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 flex中自定义皮肤的按钮制作 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

今天聊一下FLEX中自定義皮膚的按鈕的制作。首先這是一個按鈕皮膚文件:

<?xml version="1.0" encoding="utf-8"?> <s:SparkSkin 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"><!-- host component --><fx:Metadata><![CDATA[ [HostComponent("spark.components.Button")] //表明這是一個按鈕皮膚]]></fx:Metadata><!-- states --><!--按鈕的四種狀態--><s:states><s:State name="up" /><s:State name="over" /><s:State name="down" /><s:State name="disabled" /></s:states><!-- skinParts中定義的外觀部件,表示按鈕上的文字--><s:Label id="labelDisplay"textAlign="center"verticalAlign="middle"maxDisplayedLines="1"horizontalCenter="0" verticalCenter="1"left="10" right="10" top="2" bottom="2"></s:Label></s:SparkSkin>

在Flex4.0 API中,打開spark.components.Button可以看到:

這里定義了按鈕的幾種狀態,而則是按鈕的外觀部件,這里指的是按鈕上面的文字。

?

然后我為按鈕指定一個填充背景:

<s:Rect id="buttonColor" top="0" bottom="0" left="0" right="0"radiusY="50" radiusX="50"width.over="900" width.down="700" > <s:fill><s:SolidColor color.up="#0074aa" color.over="#64BC48" color.down="#FF7256"/></s:fill>

?

此時我們應用這個小皮膚會發現,按鈕上的文字有點按鈕難以看清,此時有一個小技巧就是將Label的顏色改為白色.

接下里給按鈕加上狀態切換時候的動畫:

<s:transitions><s:Transition fromState="up" toState="over"> <s:Resize target="{buttonColor}" widthBy="100"/> </s:Transition><s:Transition fromState="over" toState="up"> <s:Resize target="{buttonColor}" widthBy="-100"/> </s:Transition><s:Transition fromState="over" toState="down"> <s:Resize target="{buttonColor}" widthBy="-100"/> </s:Transition></s:transitions>

在這里我發現了一個問題,就是我用這些效果起作用的前提是你的按鈕的寬度都是固定的

<!--不能在此設定按鈕的寬度--><s:Button label="定制按鈕實例_Flex開發課堂" fontFamily="黑體" fontSize="40"top="10" skinClass="skins.really_defaultButton"horizontalCenter="0" verticalCenter="0"></s:Button>

到這里一個自定義皮膚的按鈕就做好了。

2013-07-25 09:25:04

?

?

轉載于:https://www.cnblogs.com/fuwanqiu/p/3213570.html

總結

以上是生活随笔為你收集整理的flex中自定义皮肤的按钮制作的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。