Select to view content in your preferred language

Error on FeatureLayer_Mouseover_Snapshot

1086
3
06-20-2011 02:51 PM
MattJensen
Emerging Contributor
I don't understand why I get the error "The prefix "esri" for element "esri:SimpleFillSymbol" is not bound." on line 68, when all I do is copy and past code from the original file to a new file?
Line          Code
68  <esri:SimpleFillSymbol id="mouseOverSymbol" alpha="0.5">
69   <esri:SimpleLineSymbol width="0" color="0xFF0000"/>
70  </esri:SimpleFillSymbol>
71  <esri:SimpleFillSymbol id="defaultsym" alpha="0.2">
72   <esri:SimpleLineSymbol width="1" color="0xEEEEEE"/>
73  </esri:SimpleFillSymbol>

The code looks to be bound to me

Thank you for your time,
Titoqan
Tags (2)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus
Matt,

   Do you have the
xmlns:esri="http://www.esri.com/2008/ags"
in the top most element?
0 Kudos
MattJensen
Emerging Contributor
Thanks, that was it.

Now I am trying to get the infoWindow to pull data from data that is loaded in an esri:featureLayer that I have loaded.  To see what I have done click http://204.236.161.112/CBWS_MouseOver.html.  I know I need to update "myTextArea.htmlText" but for the FIPS: I am trying to point to the correct field in my data.  Here is a link to my published map services data http://204.236.161.112/ArcGIS/rest/services/CountyCombined-added/MapServer
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      xmlns:esri="http://www.esri.com/2008/ags"
      pageTitle="CBWS-test">
 
 <fx:Script>
  <![CDATA[
   import com.esri.ags.Graphic;
   import com.esri.ags.SpatialReference;
   import com.esri.ags.events.GraphicEvent;
   import com.esri.ags.geometry.Extent;
   
   protected function countyData_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.htmlText = "<b> FIPS: </b>" + gr.attributes.ba_cb_cty.FPS.toString() + "\n"
     + "<b>County Name: </b>" + gr.attributes.NAME.toString() + "\n"
     + "<b>Males: </b>" + gr.attributes.MALES + "\n"
     + "<b>2007 Females: </b>" + gr.attributes.FEMALES + "\n"
     + "<b>Total Population in 2007: </b>" + gr.attributes.POP2007;
    myMap.infoWindow.label = gr.attributes.NAME;
    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 = defaultsym;
    myMap.infoWindow.hide();
   }
   
   private function zoomCBWS():void
   {
    var CBWSExtent:Extent = new Extent(-8200000, 4450000, -8000000, 5200000, new SpatialReference(102100));
    myMap.extent = CBWSExtent;
    
    // make sure the whole extent is visible
    if (!myMap.extent.contains(CBWSExtent))
    {
     myMap.level--;
     
    }
   }
  ]]>
 </fx:Script>
 
 <fx:Style>
  @namespace esri "http://www.esri.com/2008/ags";
  
  esri|InfoWindow
  {
   content-background-alpha : 0;
   background-color : yellow;
   background-alpha : 0.8;
   border-style : solid;
  }
 </fx:Style>
 
 <fx:Declarations>
  <esri:SimpleFillSymbol id="mouseOverSymbol" alpha="0.5">
   <esri:SimpleLineSymbol width="0" color="0xFF0000"/>
  </esri:SimpleFillSymbol>
  <esri:SimpleFillSymbol id="defaultsym" alpha="0.2">
   <esri:SimpleLineSymbol width="1" color="0xEEEEEE"/>
  </esri:SimpleFillSymbol>
 </fx:Declarations>
 
 <s:layout>
  <s:VerticalLayout/>
 </s:layout>
 
 <esri:Map id="myMap" load="zoomCBWS()">
  <esri:infoWindowContent>
   <mx:TextArea id="myTextArea"
       width="250" height="95"/>
  </esri:infoWindowContent>
  <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
    <esri:FeatureLayer id="countyData"
   url="http://204.236.161.112/ArcGIS/rest/services/CountyCombined-added/MapServer/4" alpha=".8"/>
 </esri:Map>
 
 <s:Label width="100%"
    text="Need to find and insert 'code' for name of layer loaded."/>
 
</s:Application>


I am ultimately trying to combine the mouse over with the table of contents (http://204.236.161.112/_CBWS03.html) and I need to show my legends in a pop-up window of sorts.

Thank you for your time
Matt
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Matt,

   Here are the areas of your code (in red) that fixes what you had:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               xmlns:esri="http://www.esri.com/2008/ags"
               pageTitle="CBWS-test">
    
    <fx:Script>
        <![CDATA[
            import com.esri.ags.Graphic;
            import com.esri.ags.SpatialReference;
            import com.esri.ags.events.GraphicEvent;
            import com.esri.ags.geometry.Extent;
            
            protected function countyData_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.htmlText = "<b> FIPS: </b>" + gr.attributes['ba_cb_cty.FPS'] + "\n"
                    + "<b>County Name: </b>" + gr.attributes['ba_cb_cty.Name'] + "\n";
                myMap.infoWindow.label = gr.attributes.NAME;
                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 = defaultsym;
                myMap.infoWindow.hide();
            }
            
            private function zoomCBWS():void
            {
                var CBWSExtent:Extent = new Extent(-8200000, 4450000, -8000000, 5200000, new SpatialReference(102100));
                myMap.extent = CBWSExtent;
                
                // make sure the whole extent is visible
                if (!myMap.extent.contains(CBWSExtent))
                {
                    myMap.level--;
                    
                }
            }
        ]]>
    </fx:Script>
    
    <fx:Style>
        @namespace esri "http://www.esri.com/2008/ags";
        
        esri|InfoWindow
        {
            content-background-alpha : 0;
            background-color : yellow;
            background-alpha : 0.8;
            border-style : solid;
        }
    </fx:Style>
    
    <fx:Declarations>
        <esri:SimpleFillSymbol id="mouseOverSymbol" alpha="0.5">
            <esri:SimpleLineSymbol width="0" color="0xFF0000"/>
        </esri:SimpleFillSymbol>
        <esri:SimpleFillSymbol id="defaultsym" alpha="0.2">
            <esri:SimpleLineSymbol width="1" color="0xEEEEEE"/>
        </esri:SimpleFillSymbol>
    </fx:Declarations>
    
    <s:layout>
        <s:VerticalLayout/>
    </s:layout>
    
    <esri:Map id="myMap" load="zoomCBWS()">
        <esri:infoWindowContent>
            <mx:TextArea id="myTextArea"
                         width="250" height="95"/>
        </esri:infoWindowContent>
        <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
        <esri:FeatureLayer id="countyData" useAMF="true" mode="onDemand" graphicAdd="countyData_graphicAddHandler(event)"
                           url="http://204.236.161.112/ArcGIS/rest/services/CountyCombined-added/MapServer/4" alpha=".8" outFields="
  • "
  • />     </esri:Map>         <s:Label width="100%"              text="Need to find and insert 'code' for name of layer loaded."/>     </s:Application>
    0 Kudos