using dynamic tooltip text

you can dynamically add text to your tooltip and its simple.

First get the text which u want to add to tooltip : here i want the textinput text

<mx:TextInput id=”txtmail” />  — this contains the text to add to tooltip

<mx:Button id=”btnmail” toolTip=”click to mail to{txtmail.text}” /> — here the tooltip appears when the user moves the mouse on to the button as “click to mail to {textinput text}

The text entered in the textinput will appear as the button tooltip dynamically.

Ex: if user enters kumar@yahoo.com in textinput and moves the mouse on to the button then the tooltip text will be click to mail to kumar@yahoo.com

Another approach to creating dynamic tooltip is to intercept the  ToolTip in its toolTipShow event handler and change the values of its text property. the below examples shows this.

public function initApp():void

{

b1.addEventListener(ToolTipEvent.TOOL_TIP_SHOW, myToolTipChanger)

}

public function myToolTipChanger(event:ToolTipEvent):void

{

ToolTipManager.currentToolTip.text = “Click the button buttom to login”;

}

and the button is

<mx:Button id=”b1″ label=”Click Me” />

so this is how u dynamically add text to tooltip.

One Response to “using dynamic tooltip text”

  1. Linda22 wears undies Says:

    One more approach to creating dynamic tooltip is to intercept the  ToolTip in its toolTipShow event handler and change the values of its text property.

Leave a Reply