views:

87

answers:

2

How to style parts of the tooltip e.g. bold? I’m generating a tooltip in an itemrenderer for an datagrid, displaying the column name and then the value: I want to display the value bold…

    public override function set data(value:Object):void
{
var dg:DataGrid = this.listData.owner as DataGrid;
var dataField:String = (dg.columns[this.listData.columnIndex] as DataGridColumn).dataField;

var toolString:String = “”;
for(var i:int = 0; i < dg.columns.length; i++)
{
var fieldName:String = (dg.columns[i] as DataGridColumn).dataField;
toolString = StringUtil.substitute("{0}{1}: {2}\n", toolString, fieldName, displayString(value[fieldName]));
}
this.toolTip = toolString;

super.data = value;
this.text = displayString(value[dataField]);
}
A: 

If you want to change all tooltips in your application, you can do so w/ CSS, as described in the docs herelink text.

I have found that to often be limiting, so it is more common I would create a custom toolTip.

The documentation is a bit confusing if memory serves me, so to create a custom toolTip you listen to the toolTipCreate method and replace the event.toolTip with your new toolTip. Toi position the new toolTip something other than the default, you must do that in a toolTipShow listener.

www.Flextras.com
you can set http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3/mx/managers/ToolTipManager.html?allClasses=1#toolTipClass instead of listening to the tooltipCreate, if you want to change all the tooltips...
Gregor Kiddie
A: 

Just use custom simple HTMLToolTip class for your tooltips

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

JabbyPanda