Select to view content in your preferred language

Mouseover issue on Feature Layer

796
1
09-13-2011 08:13 AM
ShravanBonagiri
Deactivated User
Hi All,

I am working on having a mouse over on my Feature layer. I tried implementing the code shown in the Mouseover on Feature Layer. http://help.arcgis.com/en/webapi/flex/samples/index.html#/InfoWindow_on_MouseOver/01nq0000001q000000...
I get the Type error: Error # 1034: Type coercion failed. Please see the attached image. It is the problem with com.esri.ags.Graphic. I guess I'm doing something wrong here. I really appreciate your help here. Thanks much.

Here is my code:
protected function fLayer_graphicAddHandler(event:GraphicEvent):void
   { 
   
    event.graphic.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);
    event.graphic.addEventListener(MouseEvent.MOUSE_OUT, onOutHandler);  
   }
private function onMouseOverHandler(event:MouseEvent):void
   {   
    var gr:Graphic = Graphic(event.target); //this is where the problem is?
    gr.symbol = mouseOverSymbol;
    myTextArea.htmlText = "BeachName:" +  gr.attributes['GIS.Samplets.BEACH_NAME'] + "\n" +
          "BeachName:" +  gr.attributes['GIS.Samplets.BEACH_NAME'] + "\n";
    myMap.infoWindow.closeButtonVisible = false;
    myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));
   
   }
   private function onOutHandler(event:MouseEvent):void
   {
    var gr:Graphic = Graphic(event.target);
    gr.symbol = defaultsym;
    myMap.infoWindow.hide();
   }

<esri:FeatureLayer id="fLayer"
            mode="snapshot"
            graphicAdd="fLayer_graphicAddHandler(event)"
            outFields="[GIS.Samplets.BEACH_NAME]" 
             enabled="{fLayer.enabled}"
            url="http://hostname/ArcGIS/rest/services/BeachWater/MapServer/0"
</esri:FeatureLayer>
Tags (2)
0 Kudos
1 Reply
DavidJacobs
Deactivated User
This seems related to http://forums.arcgis.com/threads/11923-Highlighting-in-Flex-Viewer-2.0.

I also need a solution to this.
0 Kudos