I have a function in my application similar to this oldie, but goodie from the dev blog.I simply add eventListeners for mouseOver and mouseOut on the graphics in a FeatureLayer's selectedFeatrues array. My function works great with Polyline, but when working with points, it would appear I have 2 graphic features for each MapPoint.In my logs, defaultSymbol is the target Symbol that I will save default symbology.highlight is the mouseOver event and reset is mouseOut event.Here is the log for mouseOver and mouseOut on a selected line a FeatureLayerhighlight: geometry of cuurentTarget: (com.esri.ags.geometry::Polyline)#0
13:40:42.926->org.lacsd.util.LayerUtil->highlight: defaultSymbol before being set: null
13:40:42.926->org.lacsd.util.LayerUtil->highlight: current symbol of graphic: null
13:40:42.926->org.lacsd.util.LayerUtil->highlight: defaultSymbol after being set: null
13:40:42.926->org.lacsd.util.LayerUtil->highlight: current symbol of graphic after set: [object SimpleLineSymbol]
reset: geometry of cuurentTarget: (com.esri.ags.geometry::Polyline)#0
13:40:43.301->org.lacsd.util.LayerUtil->reset: defaultSymbol before being set: null
13:40:43.301->org.lacsd.util.LayerUtil->reset: current symbol of graphic: [object SimpleLineSymbol]
13:40:43.301->org.lacsd.util.LayerUtil->reset: defaultSymbol after being set: null
13:40:43.301->org.lacsd.util.LayerUtil->reset: current symbol of graphic after set: null
Here is the log for exact same action on a MapPoint graphic.13:42:53.204->org.lacsd.util.LayerUtil->highlight: geometry of cuurentTarget: MapPoint[x=-13124667.797324661,y=4029073.938918875,SpatialReference[102113]]
13:42:53.204->org.lacsd.util.LayerUtil->highlight: defaultSymbol before being set: [object Symbol]
13:42:53.204->org.lacsd.util.LayerUtil->highlight: current symbol of graphic: null
13:42:53.204->org.lacsd.util.LayerUtil->highlight: defaultSymbol after being set: null
13:42:53.204->org.lacsd.util.LayerUtil->highlight: current symbol of graphic after set: [object SimpleMarkerSymbol]
13:42:53.235->org.lacsd.util.LayerUtil->highlight: geometry of cuurentTarget: MapPoint[x=-13124667.797324661,y=4029073.938918875,SpatialReference[102113]]
13:42:53.235->org.lacsd.util.LayerUtil->highlight: defaultSymbol before being set: null
13:42:53.235->org.lacsd.util.LayerUtil->highlight: current symbol of graphic: [object SimpleMarkerSymbol]
13:42:53.235->org.lacsd.util.LayerUtil->highlight: defaultSymbol after being set: [object SimpleMarkerSymbol]
13:42:53.235->org.lacsd.util.LayerUtil->highlight: current symbol of graphic after set: [object SimpleMarkerSymbol]
13:42:53.454->org.lacsd.util.LayerUtil->reset: geometry of cuurentTarget: MapPoint[x=-13124667.797324661,y=4029073.938918875,SpatialReference[102113]]
13:42:53.454->org.lacsd.util.LayerUtil->reset: defaultSymbol before being set: [object SimpleMarkerSymbol]
13:42:53.454->org.lacsd.util.LayerUtil->reset: current symbol of graphic: [object SimpleMarkerSymbol]
13:42:53.454->org.lacsd.util.LayerUtil->reset: defaultSymbol after being set: [object SimpleMarkerSymbol]
13:42:53.454->org.lacsd.util.LayerUtil->reset: current symbol of graphic after set: [object SimpleMarkerSymbol]
As you can see above, the mouseOver event fires twice. The odd part is the mouse out event only fires once. I've checked the FeatureLayer.selectedFeatures and the FeatureLayer.graphicProvider just in case, but can find no discrepency in graphic counts. Has anyone else run across a problem like this?This problem does not occur if I set the FeatureLayer.renderer manually, but I would like to see my mxd symbology before resorting to this.The problem it causes in my case is that the second mouseOver event sets the defaultSymbol to the highlighted symbol, so it never goes back to normal. I can work around this, but I'd like to know if there is something I'm missing or is this a feature somehow. Also, can anyone recreate it? Thanks.Here is my code if it makes a difference.
// add my listeners in a function
graphic.addEventListener(MouseEvent.MOUSE_OVER, highlightGraphic, false, 0, true);
graphic.addEventListener(MouseEvent.MOUSE_OUT, resetGraphic, false, 0, true);
// highlights the graphic
protected static function highlightGraphic(event:MouseEvent):void {
logger.debug("highlight: geometry of cuurentTarget: {0}", event.currentTarget.geometry);
logger.debug("highlight: defaultSymbol before being set: {0}", defaultSymbol);
logger.debug("highlight: current symbol of graphic: {0}", event.currentTarget.symbol);
// save the default symbology for the mouseOut
defaultSymbol = event.currentTarget.symbol;
// a class that pulls in preset highlight symbology based
// on geometry
event.currentTarget.symbol = highlight.getSymbol(event.currentTarget as Graphic);
logger.debug("highlight: defaultSymbol after being set: {0}", defaultSymbol);
logger.debug("highlight: current symbol of graphic after set: {0}", event.currentTarget.symbol);
}
// resets the graphic to original state
protected static function resetGraphic(event:MouseEvent):void {
logger.debug("reset: geometry of cuurentTarget: {0}", event.currentTarget.geometry);
logger.debug("reset: defaultSymbol before being set: {0}", defaultSymbol);
logger.debug("reset: current symbol of graphic: {0}", event.currentTarget.symbol);
// set the graphic symbology to original state
// using saved default symbology
event.currentTarget.symbol = defaultSymbol;
logger.debug("reset: defaultSymbol after being set: {0}", defaultSymbol);
logger.debug("reset: current symbol of graphic after set: {0}", event.currentTarget.symbol);
}