Select to view content in your preferred language

Mouse Over Info Window Problem?

780
4
03-12-2014 07:04 AM
HectorChapa
Frequent Contributor
I am trying to get information about a particular point layer on mouse over. But I notice how they are doing the code is only because they put a listner on the new symbol they added. Is there away to keep my original symbol without alternating the color.

here is the code. The code works great if you didn't care for the original color of the symbol.
But I want the original color of my layer because it changes color.

 protected function fLayer_graphicAddHandler(event:GraphicEvent):void
   {
    event.graphic.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);
    event.graphic.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutHandler);
   }
   
   private function onMouseOverHandler(event:MouseEvent):void
   {
    
    var gr:Graphic = Graphic(event.target);
    gr.symbol = mouseOverSymbol;
    myTextArea.textFlow = TextFlowUtil.importFromString("<span fontWeight='bold'>2000 Population: </span>" + gr.attributes.StateID.toString() + "<br/>"
     + "<span fontWeight='bold'>2000 Population per Sq. Mi.: </span>" + gr.attributes.FirstName + "<br/>"
     + "<span fontWeight='bold'>2007 Population: </span>" + gr.attributes.LastName + "<br/>"
     + "<span fontWeight='bold'>2007 Population per Sq. Mi.: </span>" + gr.attributes.FULLADDRESS);
    myMap.infoWindow.label = gr.attributes.FirstName;
    myMap.infoWindow.closeButtonVisible = false;
    myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));
   }
   
   private function onMouseOutHandler(event:MouseEvent):void
   {
    
    var gr:Graphic = Graphic(event.target);
    gr.symbol = null;
    myMap.infoWindow.hide();
   }

 <esri:FeatureLayer id="fLayer"
         graphicAdd="fLayer_graphicAddHandler(event)"
         mode="snapshot"
         outFields="*"
         url="http://67.78.127.3:6080/arcgis/rest/services/STEARWEBMAPTEST/FeatureServer/0"/>

<esri:SimpleMarkerSymbol id="mouseOverSymbol"
         alpha="0.9"
         color="#0000FF"
         size="11"
         style="square">
  </esri:SimpleMarkerSymbol>
  <esri:SimpleMarkerSymbol id="defaultsym"  alpha="0.1" >
  </esri:SimpleMarkerSymbol>
Tags (2)
0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus
0 Kudos
HectorChapa
Frequent Contributor
I have no idea what I am looking in there. I just dont want to use that strategy were when the graphic is remove it displays another an based on that new graphic geometry it displays the information. I want to use the current graphic. But how do I make the code execute the only reason it works is because the graphic change.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Hector,

   I am not really sure that I understand what you are wanting. If you just want the featurelayer to retain the same symbology when you mouse over it than just comment out or remove the lines where the event handlers manipulate the graphics symbology...

            private function onMouseOverHandler(event:MouseEvent):void
            {
                
                var gr:Graphic = Graphic(event.target);
                //gr.symbol = mouseOverSymbol;
                myTextArea.textFlow = TextFlowUtil.importFromString("<span fontWeight='bold'>2000 Population: </span>" + gr.attributes.StateID.toString() + "<br/>"
                    + "<span fontWeight='bold'>2000 Population per Sq. Mi.: </span>" + gr.attributes.FirstName + "<br/>"
                    + "<span fontWeight='bold'>2007 Population: </span>" + gr.attributes.LastName + "<br/>"
                    + "<span fontWeight='bold'>2007 Population per Sq. Mi.: </span>" + gr.attributes.FULLADDRESS);
                myMap.infoWindow.label = gr.attributes.FirstName;
                myMap.infoWindow.closeButtonVisible = false;
                myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));
            }
            
            private function onMouseOutHandler(event:MouseEvent):void
            {
                
                //var gr:Graphic = Graphic(event.target);
                //gr.symbol = null;
                myMap.infoWindow.hide();
            }
0 Kudos
HectorChapa
Frequent Contributor
Let me try I let you know if I get the results.
0 Kudos