我需要在由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,则可以正常工作。
请帮帮忙。
发布于 2010-12-31 20:13:03
只要看一下ToolTipManagerImpl的代码,你就会得到答案。下面是createToolTip函数创建toolTip的方式:
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实现中的所有代码并进行更改
var toolTip:ToolTip = new ToolTip(); -> var toolTip:ToolTip = new HTMLToolTip();使用您提到的页面中的组件。
PS:你也需要复制sizeTip函数。
https://stackoverflow.com/questions/4569752
复制相似问题