zoukankan      html  css  js  c++  java
  • flex toolTip样式设置

     

       

    需要3个文件。一个是样式类,一个样式文件,一个是mxml文件。

    ●MyToolTip.as

    package{
     import mx.core.UITextField;
     import mx.skins.halo.ToolTipBorder;
     import mx.controls.ToolTip;
     public class MyToolTip extends ToolTipBorder {
      
      
      override protected function updateDisplayList(unscaledWidth:Number,
       unscaledHeight:Number):void{
        
        var toolTip:ToolTip = (this.parent as ToolTip);
        var textField:UITextField = toolTip.getChildAt(1) as UITextField;
        textField.htmlText = textField.text;
        
        
        var calHeight:Number = textField.height;
        calHeight += textField.y*2;
        calHeight += textField.getStyle("paddingTop");
        calHeight += textField.getStyle("paddingBottom");
        
        
        var calWidth:Number = textField.textWidth;
        calWidth += textField.x*2;
        calWidth += textField.getStyle("paddingLeft");
        calWidth += textField.getStyle("paddingRight");
        
        super.updateDisplayList(calWidth, calHeight);
       }
     }
    }

    ●style.css

    ToolTip{
        font-family:            verdana;
        font-size:              14px;
        color:                  #000000;
              #FF00FF;
        background-alpha:       0.85;
        cornerRadius:           10;
        borderSkin:             ClassReference("MyToolTip"); 
    }

    ●toolTipDemo.mxml

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml " layout="absolute" width="640" height="477">
            <mx:Script>
        <![CDATA[
            [Bindable]
            private var myToolTipText:String = "<b>This is a bold toolTip</b>" ;
        ]]>
    </mx:Script>
    <mx:Style source="style.css"/>
        <mx:Button label="hover to get tooltip" toolTip="{myToolTipText}"
    x="36" y="28"/>
    </mx:Application>

  • 相关阅读:
    几款比较好用的思维导图工具
    单例模式的七种实现
    从中央仓库下载所想要的jar包
    单例模式实现的几种方式
    两个数组比较看看结果
    CSS 基础 例子 伪元素和伪类 & 区别
    CSS 基础 例子 背景色 & 背景图片
    CSS 基础 例子 水平 & 垂直对齐
    CSS 基础 例子 浮动float
    CSS 基础 例子 行高line-height
  • 原文地址:https://www.cnblogs.com/HeroZearin/p/4311030.html
Copyright © 2011-2022 走看看