当前位置: 代码网 > it编程>网页制作>Flex > Flex设置LinkButton的背景色有思路有源码

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

2024年05月15日 Flex 我要评论
1、设计思路由于flex中没有设置linkbutton的背景色的属性,现在得从两个方面入手:第一,直接通过调用样式方法画出linkbutton的背景色;第二,设置linkbutton的背景图片。这里,

1、设计思路

由于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 width="100%"> 
<mx:linkbutton id="mylinkbutton" label="查询" x="100" y="100"/> 
</mx:vbox> 
</s:application>

3、设计结果

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com