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é)果
標(biāo)簽:仙桃 呂梁 滄州 佛山 攀枝花 泰州 欽州 海西
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Flex設(shè)置LinkButton的背景色有思路有源碼》,本文關(guān)鍵詞 Flex,設(shè)置,LinkButton,的,背,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。