I am trying to make a custom Flex tooltip a la this tutorial. It’s basically just a bunch of labels showing a colour legend. This all works fine and well when the tooltip shows from the button event toolTipCreate:
<mx:Button label="ToolTip example" toolTip=" "
toolTipCreate="toolTipCreateHandler(event)" />
However, I want to show the tooltip when the button is clicked and not wait for the actual tooltip delay. (In this sense, I’m not even sure if the terminology “tooltip” even applies anymore, but that’s for another time). I call the same handler with an instantiated ToolTipEvent being passed as the argument:
<mx:Button label="ToolTip example" toolTip=" "
click="toolTipCreateHandler(new ToolTipEvent(ToolTipEvent.CREATE, false, false, instanceOfMyCustomToolTip))" />
However, this doesn’t work, and it’s driving me up the wall trying to figure out how to do this. This doesn’t seem like such an uncommon thing to do, but every example I find on the internet uses the actual tooltip delay instead of a button click. Any help would be appreciated.
P.S. – I want to do it as a tooltip specifically so I can try to get the little “balloon tail” as shown here.
EDIT: I have also tried ToolTipManager.createToolTip in the click event of the button, but this doesn’t work either.
<mx:Button id="ttt" label="Tooltip test"
click="ToolTipManager.createToolTip(' ',75,75,'errorTipBelow',instanceOfMyCustomToolTip)"/>
After much research, this is impossible in its current form. Here is what should work:
At this point, the ToolTipManager should create a new tooltip using the class specified in
ToolTipManager.toolTipClass. However, due to a yet-unresolved bug in the Adobe Flex SDK,ToolTipManager.createToolTipignores this class and always uses the default classToolTip.So nothing short of a monkey patch will get this to work correctly. Found info on this bug (and corresponding patch) in this blog post. The post talks about Flex 3, but this bug is still unresolved as of Flex 4.5.1.