The tooltip In Flex is a rectangle box with a text box. You can modify the style to set its size and background, font color, but cannot change its shape. If you want a tooltip such as a pentagram, You have to customize it. The following is a brief introduction to the custom tooltip method. The procedure is the same as that of other custom components. Because tooltip itself is a component, you only need to implement the itooltip interface
Create a component named mytooltip:
implements = "MX. core. itooltip "
width =" 500 "Height =" 100% "backgroundcolor =" # ffd7ff "borderstyle =" solid "cornerradius =" 5 ">
[Bindable]
private VaR _ text: string;
Public Function get text (): string
{< br> return this. _ text;
}< br>
public function set text (value: string): void
{< br> This. _ text = value;
}< br>]>
ThenProgramThe tooltip is used to listen to the tooltipcreate event in the component to display the tooltip. This event is called before the tooltip is created. Therefore, you can create a custom tooltip here, if you want to locate the position of the tooltip, you can listen to its tooltipshow event, which is called when you want to display the tooltip
<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" verticalalign = "Middle">
<Mx: SCRIPT>
<! [CDATA [
Import MX. Events. tooltipevent;
Private function createmediltip (E: tooltipevent): void
{
VaR tip: mytooltip = new mytooltip ();
E. tooltip = tip;
}
// Tooltip positioning
Private function positiontooltip (E: tooltipevent): void
{
// Locate the tooltip at (5, 5) above the component.
// Var PT: Point = new point ();
// Pt. x = 0;
// Pt. Y = 0;
// Pt = BTN. localtoglobal (PT );
// E. tooltip. x = pt. x + 5;
// E. tooltip. Y = pt. Y-35;
// Position the tooltip below the current mouse (10, 20)
E. tooltip. x = mousex + 10;
E. tooltip. Y = Mousey + 20;
}
]>
</MX: SCRIPT>
<Mx: button id = "BTN" label = "testtooltip" tooltip = "test"
Tooltipcreate = "createconltip (event)" tooltipshow = "positiontooltip (event)"/>
</MX: Application>