Feature Tooltip/Maptip for FlexViewer 2.2

1485
21
01-21-2011 09:28 AM
RobertScheitlin__GISP
MVP Emeritus
All,

   Here is a very simple widget for displaying a map tip on mouse over of a layer that is a Feature type operational or basemap layer. It REQUIRES a layer that is type="feature" to work.

http://www.arcgis.com/home/item.html?id=ce63f1bdd5e64068b9a4fadd2028e379
Tags (2)
0 Kudos
21 Replies
EricAnderson
New Contributor II
I had some issues with this as well but the problems were on my end.  I am using a map service (AGS 9.3) for my feature layer.

I was also getting this error on application startup:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at widgets.FeatureTooltip::FeatureTooltipWidget/setTooltip()[<mywebsitepath>\src\widgets\FeatureTooltip\FeatureTooltipWidget.mxml:75]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at com.esri.ags.layers::FeatureLayer/enterFrameHandlerSecond()

That message made me think the data wasn't loading since I couldn't see the data nor was there a little triangle next to the layer under the "More.." button.

But it turns out, I had the alpha at "0" so I couldn't see the layer. Also, for single layers under the "More.." button, no little triangle will be present to the left of the service's name - that is by design for single layers.

And the Nulls were in my data (which was, it turns out, loading).  I will trap for that as a modification.

I am wondering though, where can I change the "sensitivity" of the hover?  It seems really difficult and touchy to get the tooltip to activate - lots of micro-mousing over a feature (line) just to get it to work.

Thanks for any assistance,

Eric
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Nathan,

   The first thing I would try is set the alpha to 1 to see if the feature are showing on the map properly.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Eric,

   I will update the download for the null error trapping soon. but here is the code if you are compiling the widget yourself

   private function setTooltip(event:Event):void
   {
    var fl:FeatureLayer = event.currentTarget as FeatureLayer;
    for(var l:int=0; l<configFeatureLayers.length; l++)
    {
     if(fl.id == configFeatureLayers.layer)
     {
      var flds:String = configFeatureLayers.fields;
      var fldArr:Array = flds.split(",");
      for each (var gra:Graphic in fl.graphicProvider)
      {
       var toolTip:String = "";
       for (var f:int=0; f<fldArr.length; f++)
       {
        toolTip += gra.attributes[fldArr] ? String(gra.attributes[fldArr]) + "\n" : "";
       }
       if (toolTip != "")
        gra.toolTip = toolTip;
      }
     }
    }
   }
0 Kudos
NathanEnge
Esri Contributor
Nathan,

The first thing I would try is set the alpha to 1 to see if the feature are showing on the map properly.


Highly strange. I've tried the following:
<layer label="Species feature" type="feature" visible="true"
             url="http://www.mapservices.ca/ArcGIS/rest/services/Prima/Prima_Operational/MapServer/5"/>

and
 <layer label="Species dynamic" type="dynamic" visible="true"
             url="http://www.mapservices.ca/ArcGIS/rest/services/Prima/Prima_Operational/MapServer/5"/> 

No Joy. it doesn't show up. So if I specify a layer from a mapservice it is not showing up. It does have scale dependency but even when zoomed to the visible scale, it does not show up for either dynamic or feature type.

However if I add the parent mapservice as dynamic:
<layer label="Operational" type="dynamic" visible="true"
url="http://www.mapservices.ca/ArcGIS/rest/services/Prima/Prima_Operational/MapServer"/>

it shows up, like it is suppose to. However, if I change type="feature" and it does not show up. 

Is there something I have to do in the original MXD (like turn tooltip on in the properties) before I save it as MSD and publish?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Nathan,

   I have been playing around with your rest endpoint to see what is going on and I can not explain why the FlexViewers layer using type feature does not work with your map service. Untill you get the map service to function properly with just displaying the layer a a feature layer there is really no hope on getting it to work with my widget. 😞
0 Kudos
MGSethe
New Contributor II
Jake,
one of the reason for features not getting displayed on the map is that  features only when they are within visible scale range.(between min and max scale.)


Hello, How you get the tool working if you zoomed in to the features?.
Please help
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Golden,

   Just switch back to the pan tool.
0 Kudos
CynthiaMatney
New Contributor
Robert,

Hello.  I have the tool tip working just fine with one of my point layers.  However, I was wondering if there was a way to get the points to have a hover over highlight function like the site below has.
http://outdoornebraska.ne.gov/gisapps/default.asp

Thanks!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Cynthia,

   No, those a basically info windows and not tool tips like this widget is designed for.
0 Kudos
BrianKratcha
New Contributor III
Is there a way to combine two fields together in one row.  For example I want to have CITY, STATE, & ZIP fields all show up in the same row.  I could create a new field in ArcMap and combine them that way, but I would prefer not to if there was a simple procedure.  The "&" sign  or "+" sign do not work.

        <layer>
            <name>Municipalities</name>
            <fields>COMPNAME,PHONE,ADDRESS,CITY,STATE,ZIP</fields>
        </layer>

Great Widget by the way,
      
Thanks,

Brian
0 Kudos