2010-12-31 5 views
0

TooltipManagerで作成したカスタムツールチップにhtmlTextを表示する必要があります。flextext tooltipで作成されたヒントのテキスト

以下はコードです。

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を設定している場合、それは動作します:ボタン。

助けてください。

答えて

1

ToolTipManagerImplのコードを見てみると、あなたの答えが得られます。ここでcreateToolTip機能は、ツールチップを作成する方法は次のとおりです。

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機能の独自の実装を使用して独自のユーティリティクラスを作成します。アドビの実装と変更からすべてのコードをコピーしてください。

var toolTip:ToolTip = new ToolTip(); -> var toolTip:ToolTip = new HTMLToolTip(); 

あなたが言及したページのコンポーネントを使用してください。

PS:sizeTipの機能もコピーする必要があります。

関連する問題