Select to view content in your preferred language

Element Not Bound error help please

3841
2
06-12-2011 02:59 AM
MattJensen
Emerging Contributor
Hello,

I have been trying to combine the "LegendBasic" code with "FeatureLayer - show InfoWindow on mouseOver" code and have come up with what is below.  I have a problem in line 96 it says "the prefix 'mx' for element 'mx:TextArea" is not bound, and I am lost in how to solve it.

Thank you 🙂
Titoqan


<?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:esri="http://www.esri.com/2008/ags"
               pageTitle="Legend Component">

    <!--
        This sample shows how to use the Legend component to build a legend that displays some or all of the layers in the map.
        To create a new legend component specify the map to be displayed.
        Optionally you can provide a list of layers to display in the legend.
        If no layers are specified then all the layers will display in the legend.

        The respectCurrentMapScale property, if set to true (default) will force the legend component to only display layers that are visible in the current map scale.
    -->

    <s:layout>
        <s:HorizontalLayout gap="0"/>
    </s:layout>

    <esri:Legend id="myLegend"
                 width="250" height="100%"
                 layers="{[ legendLayer ]}"
                 map="{myMap}"
                 respectCurrentMapScale="true"/>

 <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 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.htmlText = "<b>2000 County FIPS: </b>" + gr.attributes.ba_cb_cty.FPS.toString() + "\n"
     + "<b>County Name: </b>" + gr.attributes.Name.toString() + "\n"
     + "<b>: </b>" + gr.attributes.MALES + "\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 zoomToSouthCarolina():void
   {
    var southCarolinaExtent:Extent = new Extent(-9294000, 3667000, -8739000, 4217000, new SpatialReference(102100));
    myMap.extent = southCarolinaExtent;
    
    // make sure the whole extent is visible
    if (!myMap.extent.contains(southCarolinaExtent))
    {
     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>
 
    <esri:Map id="myMap">
  <esri:infoWindowContent>
   <mx:TextArea id="myTextArea" width="250" height="95">
   </mx:TextArea>
  </esri:infoWindowContent>
        <esri:ArcGISTiledMapServiceLayer id="baseLayer" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
        <esri:ArcGISDynamicMapServiceLayer id="legendLayer" name="Projected Population in 2025"
                                           url="http://204.236.161.112/ArcGIS/rest/services/CountyCombined-added/MapServer/4" alpha=".7"/>
  <esri:extent>
   <esri:Extent xmin="-11866000" ymin="-284000" xmax="-7977000" ymax="2919000">
    <esri:SpatialReference wkid="102100"/>
   </esri:Extent>
  </esri:extent>
 </esri:Map>

</s:Application>

PS.  Eventually, I am trying to dynamically show the correct legend when a layer is turned on, as well as the correct mouseovers.
http://204.236.161.112/_CBWS03.html
Thank you again
Tags (2)
0 Kudos
2 Replies
ZahidChaudhry
Deactivated User
Change it like this
<mx:TextArea id="myTextArea" width="250" height="95" />


and delete this
</mx:TextArea>

One more thing, i will clean the solution and then rebuild it...Also, you can delete the line, and rewrite it as i dont see anything wrong with it...
0 Kudos
MattJensen
Emerging Contributor
Thank you 🙂

I will try that as soon as I have a chance.

Titoqan
0 Kudos