Select to view content in your preferred language

Tooltip on a Flared Cluster

1620
6
04-07-2011 05:20 AM
JoshObrecht
Regular Contributor
I was wondering if anyone has been able to achieve this yet.  I have a Feature Layer using a Weighted Cluster.  I have been able to set the the Tooltip for the flared graphic, however it will not show.  Any help would be wonderful.
Tags (2)
0 Kudos
6 Replies
DrewDowling
Frequent Contributor
I haven't worked with clustering but Mansour wrote a post about extending the flare symbol class that might be of some use to you.

http://thunderheadxpler.blogspot.com/2010/08/image-flare-symbol-for-clustered.html
0 Kudos
JoshObrecht
Regular Contributor
I have seen that and it doesn't help as it pertains to getting tooltips to show on the flared elements.
0 Kudos
AlexJones
Emerging Contributor
Josh,

What do you want a tooltip to show on?  Are you trying to get a tooltip on the main graphic? This would be the graphic that is showing the count...

Please let me know.

Alex
0 Kudos
JoshObrecht
Regular Contributor
I want the tooltips on the smaller elements that show after it flares.
0 Kudos
AlexJones
Emerging Contributor
I assume that there is an easier way than this; however, I did not have much luck. So, you can create a custom tooltip and use it. Just listen for your roll over/roll out and it will display.

Using the sample code from the flex api samples page you can add this:

   import mx.controls.ToolTip;  
                                import mx.managers.ToolTipManager;
   
   private  var customToolTip:ToolTip;
   
   protected function map_loadHandler(event:MapEvent):void
   {
    //map.addEventListener(FlareMouseEvent.FLARE_CLICK, flareClickHandler);    
    map.addEventListener(FlareEvent.FLARE_IN_START, flareInStartHandler);    
    addEventListener(FlareMouseEvent.FLARE_OUT, rollOutHandler);
    map.addEventListener(FlareMouseEvent.FLARE_OVER, rollOverHandler);
    
   }
   private function showCustomToolTip(gr:Graphic, stagex:Number, stagey:Number):void
   {
    customToolTip = ToolTipManager.createToolTip(gr.attributes.CITY_NAME,stagex,stagey) as ToolTip;
    
   }
   protected function rollOverHandler(event:FlareMouseEvent):void
   {
    removeEventListener(FlareMouseEvent.FLARE_OVER, rollOverHandler);
    showCustomToolTip(event.graphic, event.stageX, event.stageY);
    
   }
   protected function rollOutHandler(event:FlareMouseEvent):void
   {   
    ToolTipManager.destroyToolTip(customToolTip); 
   }


You will need to play around with the listeners if you want a roll over and click, but this might get you moving in the right direction.
0 Kudos
JoshObrecht
Regular Contributor
Great! That does exactly what I need.
0 Kudos