加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex中自定义toolTip组件,以及flex中的checkBox组件奇特现象

发布时间:2020-12-15 04:33:55 所属栏目:百科 来源:网络整理
导读:1、flex自带tooltip属性看起来比较粗糙。下面是我字定义的一个tooltip组件: s:Label id="lab"? y="50" width="50" height="28" text="自定义组件,顶呱呱"? horizontalCenter="center" verticalCenter="center" /这就是一个简单的label标签。 现在给这个标

1、flex自带tooltip属性看起来比较粗糙。下面是我字定义的一个tooltip组件:

<s:Label id="lab"? y="50" width="50" height="28" text="自定义组件,顶呱呱"? horizontalCenter="center" verticalCenter="center" />这就是一个简单的label标签。

现在给这个标签加上组件方法:

?<s:Label id="lab"? y="50" width="50" height="28" text="自定义组件,顶呱呱"? horizontalCenter="center" verticalCenter="center"? toolTip="哈哈,我要显示出来"? toolTipCreate="paramTitle_toolTipCreateHandler(event)" />

函数:

?<fx:Script>???
??<![CDATA[?

protected function paramTitle_toolTipCreateHandler(event:ToolTipEvent):void
???{
????var tip:MyToolTips=new MyToolTips();
????tip.str="哈哈,我要显示出来";
????event.toolTip = tip;
???}

]]>
?</fx:Script>

子定义组件:MyToolTips

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
???? xmlns:s="library://ns.adobe.com/flex/spark"
???? implements="mx.core.IToolTip"
???? xmlns:mx="library://ns.adobe.com/flex/mx"
???? backgroundColor="#FCFFD0" alpha=".8" width="100%" borderStyle="solid" cornerRadius="7">
?<fx:Script>
??<![CDATA[
???import mx.core.IToolTip;
???[Bindable]
???public var str:String="";
???public var _text:String;
???public function get text():String {
????return _text;
???}
???public function set text(value:String):void {
???}
??]]>
?</fx:Script>
?<fx:Declarations>
??<!-- 将非可视元素(例如服务、值对象)放在此处 -->
?</fx:Declarations>
?<mx:VBox width="100%" height="100%">
??<mx:Text text="{str}" color="#000000" fontSize="13" fontFamily="宋体"/>?????<!--?你可以自己设置显示字体,大小,颜色 -->
?</mx:VBox>
</mx:Canvas>

以上完毕!谢谢

?

2、前些日子我在写flex的checkbox组件时,出现点击复选框点击不出勾,但是点击下,复选框颜色变灰。后来查了下API,发现这个selectedUpSkin属性能解决相关问题:

<mx:CheckBox id="chk" x="29" y="0" width="21" height="21" icon="undefined"? selectedUpSkin="@Embed(source='assets/checkbox.PNG')" />

附件是比较的图片。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读