Flex設(shè)置LinkButton的背景色有思路有源碼
更新時間:2014年08月19日 09:56:05 投稿:whsnow
Flex中沒有設(shè)置LinkButton的背景色的屬性,可以直接通過調(diào)用樣式方法畫出LinkButton的背景色
1、設(shè)計思路
由于Flex中沒有設(shè)置LinkButton的背景色的屬性,現(xiàn)在得從兩個方面入手:第一,直接通過調(diào)用樣式方法畫出LinkButton的背景色;第二,設(shè)置LinkButton的背景圖片。這里,講述的是第一種方法
2、設(shè)計源碼
<?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"
creationComplete="initHandler(event)">
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
/**
* 初始化函數(shù)
*/
protected function initHandler(event:FlexEvent):void
{
myLinkButton.graphics.beginFill(0x00FF00);
myLinkButton.graphics.drawRect(0,0,myLinkButton.width,myLinkButton.height);
myLinkButton.graphics.endFill();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 將非可視元素(例如服務(wù)、值對象)放在此處 -->
</fx:Declarations>
<mx:VBox width="100%">
<mx:LinkButton id="myLinkButton" label="查詢" x="100" y="100"/>
</mx:VBox>
</s:Application>
3、設(shè)計結(jié)果

相關(guān)文章
js調(diào)用Flex中的方法并向flex中傳參及flex調(diào)用js示例
本文為大家詳細介紹喜愛js調(diào)用Flex中的方法以及向flex中傳參與flex調(diào)用js,具體示例如下,感興趣的朋友不妨參考下,希望對大家有所幫助2013-07-07
flex actionScript時間處理相加返回相加后的date
這篇文章主要介紹了flex actionScript時間處理相加返回相加后的date,需要的朋友可以參考下2014-07-07
flex利用webservice上傳照片實現(xiàn)代碼
這篇文章主要介紹了flex利用webservice上傳照片實現(xiàn)代碼,需要的朋友可以參考下2014-05-05

