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.

Advertisements

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: