Select to view content in your preferred language

No mouse over event being dispatched/handled in FeatureLayer

819
3
12-07-2010 12:31 PM
JamesAdams
Emerging Contributor
I am following the "InfoWindow on MouseOver" example from the ArcGIS API for Flex Samples page.  I have added event listeners for MouseEvent.MOUSE_OVER events as described but when I mouse over the graphics of the FeatureLayer my application never goes into the handler function when I run it in debug mode from Flash Builder (Flex 4), which I assume means that either 1) no event is being dispatched when I mouse over the graphics of the layer, and/or 2) for whatever reason the event is not being handled by the function registered as the listener for the event.  How can I determine where the problem lies?  Is there perhaps a set of requirements which services must satisfy in order to function as a FeatureLayer as described by this example, and if so where is this documented (i.e. perhaps there's something amiss with the MapServer service I'm using)?  Can anyone suggest why I don't get a mouse over event when I mouse over the points of the layer?

Thanks in advance for any suggestions, etc.

--James
Tags (2)
0 Kudos
3 Replies
ReneRubalcava
Esri Frequent Contributor
I had the odd issues when I started working with FeatureLayer.
Try listening on the rollOver/rollOut events instead, see if that helps.
http://forums.arcgis.com/threads/8747-Odd-behavior-of-FeatureLayer-and-MapPoint-graphics
0 Kudos
JamesAdams
Emerging Contributor
Thanks for your response.  I have already tried that but with no joy.  To wit my code looks like this:

            protected function stationGraphicAddHandler(event:GraphicEvent):void
            {
                // set up mouse/roll over handlers
                event.graphic.addEventListener(MouseEvent.MOUSE_OVER, stationGraphicMouseOverHandler);
                event.graphic.addEventListener(MouseEvent.ROLL_OVER, stationGraphicMouseOverHandler);
                event.graphic.addEventListener(MouseEvent.MOUSE_OUT, stationGraphicMouseOutHandler);
                event.graphic.addEventListener(MouseEvent.ROLL_OUT, stationGraphicMouseOutHandler);
            }


I have even removed the rollover event handler for the map in which the feature layer is embedded but this gives no joy either.

The post referenced in the response above shows log messages -- how can I see these for my application?  Perhaps this would give me some more insight into the problem?
0 Kudos
DavidMarley
Frequent Contributor
James,

I am trying to do the same thing, and having the same issue (event never firing).  In my case I am trying to make this work in an application based on the ESRI Flex Template, so I cannot simply attach the "graphics add" event in the map/layer markup like that sample shows.  As a result I think I am attaching the handler AFTER the layer is already loaded, thus all the graphics are added...and so my event handler never fires.  Perhaps your issue is similar...

I'm going to start my own thread about this, and will post back here if I find anything.

Regarding how to generate the logging/debug messages, I use "trace" from within FlashBuilder 4 - if you run your app in Debug mode, all trace output is written to the FlashBuilder console - very handy.  Here is a short example:

protected function btnUpdAttr_clickHandler(event:MouseEvent):void
{
 trace("upd attr: '" + descriptionTextAreaText + "'");
}
0 Kudos