首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >由TooltipManager创建的工具提示中的flex htmlText

由TooltipManager创建的工具提示中的flex htmlText
EN

Stack Overflow用户
提问于 2010-12-31 19:17:46
回答 1查看 3.1K关注 0票数 0

我需要在由TooltipManager创建的自定义工具提示中显示htmlText。

下面是代码。

myToolTip = ToolTipManager.createToolTip(text, pt.x, pt.y, "errorTipAbove") as ToolTip; myToolTip.setStyle("borderColor", "#FAF8CC"); myToolTip.setStyle("color", "black"); myToolTip.setStyle("fontSize","9");

我已经尝试了下面的方法。

http://flexscript.wordpress.com/2008/08/19/flex-html-tooltip-component/

但是,如果我们将htmlText设置为一个工具提示,例如: button,则可以正常工作。

请帮帮忙。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-12-31 20:13:03

只要看一下ToolTipManagerImpl的代码,你就会得到答案。下面是createToolTip函数创建toolTip的方式:

代码语言:javascript
复制
public function createToolTip(text:String, x:Number, y:Number,
    errorTipBorderStyle:String = null, context:IUIComponent = null):IToolTip{

    var toolTip:ToolTip = new ToolTip();

    var sm:ISystemManager = context ? context.systemManager as ISystemManager:
        ApplicationGlobals.application.systemManager as ISystemManager;
    sm.topLevelSystemManager.addChildToSandboxRoot(
        "toolTipChildren", toolTip as DisplayObject);

    if (errorTipBorderStyle){
        toolTip.setStyle("styleName", "errorTip");
        toolTip.setStyle("borderStyle", errorTipBorderStyle);
    }

    toolTip.text = text;

    sizeTip(toolTip);

    toolTip.move(x, y);
    // Ensure that tip is on screen?
    // Should x and y for error tip be tip of pointy border?

    // show effect?

    return toolTip as IToolTip;
}

所以你的答案是:

使用自己的createToolTip函数实现创建自己的实用程序类。复制Adobe实现中的所有代码并进行更改

代码语言:javascript
复制
 var toolTip:ToolTip = new ToolTip(); -> var toolTip:ToolTip = new HTMLToolTip();

使用您提到的页面中的组件。

PS:你也需要复制sizeTip函数。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4569752

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档