站长网 Unix Flex设置LinkButton的背景色有思路有源码

Flex设置LinkButton的背景色有思路有源码

由于Flex中没有设置LinkButton的背景色的属性,现在得从两个方面入手:第一,直接通过调用样式方法画出LinkButton的背景色;第二,设置LinkButton的背景图片。这里,讲述的是第一种方法 2、设计源码 xml version=”1.0″ encoding=”utf-8″ s:Application xml

由于Flex中没有设置LinkButton的背景色的属性,现在得从两个方面入手:第一,直接通过调用样式方法画出LinkButton的背景色;第二,设置LinkButton的背景图片。这里,讲述的是第一种方法

2、设计源码

<?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;
/**
* 初始化函数
*/
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>
<!– 将非可视元素(例如服务、值对象)放在此处 –>
</fx:Declarations>
<mx:VBox>
<mx:LinkButton label=”查询” x=”100″ y=”100″/>
</mx:VBox>
</s:Application>

3、设计结果

Flex设置LinkButton的背景色有思路有源码

本文来自网络,不代表站长网立场,转载请注明出处:https://www.tzzz.com.cn/html/server/unix/2021/0526/6817.html

作者: dawei

【声明】:站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。
联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部