The first question is “From where does the ToolTip gets his Border ?“, well the answer to this question is from the ToolTipBorder Class.And this Class draws the border to the ToolTip., this class is from the Package mx.skins.halo and ToolTipBorder.as is the ActionScript Class.
Now lets see how can we change this Default Border of the ToolTip.[changes to this .as Class].Open the .as class from the sdk’s in the FlexBuilder installation folder as given per the package[look in to the package’s]
Now if you can see the Class File[.as] ,the updateDisplayList() is the method which draws the ToolTipBorder and in this method there’s a switch() statement and in this the “tooltip” case is the code which draws the ToolTipBorder.
And this is the code with the case statement inside the switch() statement.
3, 1, w – 6, h – 4, cornerRadius,
dropShadow = new RectangularDropShadow();
dropShadow.distance = 3;
dropShadow.angle = 90;
dropShadow.color = 0;
dropShadow.alpha = 0.4;
dropShadow.tlRadius = cornerRadius + 2;
dropShadow.trRadius = cornerRadius + 2;
dropShadow.blRadius = cornerRadius + 2;
dropShadow.brRadius = cornerRadius + 2;
dropShadow.drawShadow(graphics, 3, 0, w – 6, h – 4);
Now if you want a different Border to the ToolTip change should be made to this and inside this case statement only.
For Example, I will include the following lines of code in to the “tooltip” case
// New border
var highlightAlphas:Array = [0.3,0.0];
11, 0, w – 11, h – 2, 3,
[0xFF0000, 0xFFFFBB], backgroundAlpha);
// left pointer
filters = [ new DropShadowFilter(2, 90, 0, 0.4) ];
And save the Class file[ToolTipBorder.as] as NewToolTipBorder.as in to your projects.Then to include the New Class file[NewToolTipBorder] to the Application you got to do the following code.
Now if you define the tooltip property to any visible component and run the Application you can observe the Change to the ToolTipBorder.A change to the Default border of the ToolTip is made , similarly and accordingly you can make changes to the code[case statement lines] and define your own ToolTipBorder to the ToolTip.
So Finally we made this. Click Here to view the sample Application.
This post touches the core concepts of Classes.Enjoy the post. 🙂 .Queries are welcome.