1 Reply Latest reply on Mar 29, 2012 9:49 AM by flexfun

    Looping through an array to get the index for each measure in a combo box

    flexfun

      Hi folks,

       

      I am working on a web application that has two combo boxes, one for year (called yearcombo) and for measures (called myURL) for that selected year, and also two radiobuttons (in radioBtnGroup). I have two years and a bunch of measure for each year. I  have a map tool tip that when you mouse over the county you see a measure for that specific year. However I have a bunch of measures for each year and I want to be able to loop through the measures (which are in an array collection inside a combobox) so my "if" expression can find every selectedIndex and bring me the tool tip for that selected measure for that selected radio button. Right now I would have to create if statements for each measure (each selectedIndex inside the myURL combobox)and each radiobutton (inside the radioBtnGroup) instead of creating a if expression to get a map tip tool for each measure. I know I would have to create a loop to search for these indexes and enter that in the if expression and also change the graphic.attributes to reflect the right measure or index selected. Do you API for Flex wizards  can give me any tips on how to code this according to my code below ? Any  help is greatly appreciated! (the print scree is attached)Click image for larger version  Name: screen_capture_map.jpg Views: 2 Size: 97.2 KB ID: 13106

       

       

      Below is the code snippet:

       

       

      if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)

      {

      fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"

       

      var graphic:Graphic = Graphic(event.currentTarget);

      graphic.symbol = mouseOverSymbol;

      var htmlText:String = graphic.attributes.htmlText;

      var textArea:TextArea = new TextArea();

       

      try{

      textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()

      myMap.infoWindow.content=textArea

      myMap.infoWindow.label = graphic.attributes.NAME;

      myMap.infoWindow.closeButtonVisible = false;

      myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

       

      catch(error:Error) {

      trace("Caught Error: "+error);

      }

       

       

       

       

      And below is the combo boxes with the arrays

       

      <mx:FormItem label="Year        :"  >

      <mx:ComboBox   id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)"  >

      <mx:ArrayCollection id="year"  >

       

       

      <fx:Object label="2007"  year="2007" />

      <fx:Object label="2009"  year="2009" />

       

       

      </mx:ArrayCollection>

       

       

      </mx:ComboBox>

       

      </mx:FormItem>

       

      <mx:FormItem label="Measure:">

      <mx:ComboBox   id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">

      <mx:ArrayCollection id="measures"   >

       

       

      <fx:Object id="forindout07" labeltext="2007 Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007"  />

      <fx:Object id="foremp07" label="2007 Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />

      <fx:Object id="forlabinc07" label="2007 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />

      <fx:Object id="forindbustax07" label="2007 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />

      <fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009"  />

      <fx:Object id="foremp09" label="2009 Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />

      <fx:Object id="forlabinc09" label="2009 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />

      <fx:Object id="forindbustax09" label="2009 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />

      <fx:Object id="blank" label=" "  />

      </mx:ArrayCollection> screen_capture_map.jpg

        • 1. Re: Looping through an array to get the index for each measure in a combo box
          flexfun Level 1

          And here is the entire code

           

          <?xml version="1.0" encoding="utf-8"?>

          <mx: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"

                          paddingBottom="8" paddingLeft="8"

                          paddingRight="8" paddingTop="8"

                          backgroundColor="0xffffff"

                          layout="vertical" >

             

             

              <!-- Start Declarations -->

          <fx:Declarations>

             

           

             

                  <esri:SimpleFillSymbol id="mouseOverSymbol" alpha="0.5" color="0x808080">

                      <esri:SimpleLineSymbol width="0" color="#000000"/>

                  </esri:SimpleFillSymbol>

                  <esri:SimpleFillSymbol id="defaultsym" alpha="0.01" color="#E0E0E0"   >

                      <esri:SimpleLineSymbol width="1" color="#000000"/>

                  </esri:SimpleFillSymbol>

             

           

              <!-- End Declarations -->

          </fx:Declarations>

              <fx:Script>

                  <![CDATA[

                      import com.esri.ags.Graphic;

                      import com.esri.ags.SpatialReference;

                      import com.esri.ags.esri_internal;

                      import com.esri.ags.events.GraphicEvent;

                      import com.esri.ags.geometry.Extent;

                      import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;

                      import com.esri.ags.symbols.SimpleFillSymbol;

                      import com.esri.ags.symbols.SimpleLineSymbol;

                     

                      import flash.utils.flash_proxy;

                     

                      import mx.collections.ArrayCollection;

                      import mx.controls.Alert;

                      import mx.controls.RadioButton;

                      import mx.controls.TextArea;

                      import mx.events.DropdownEvent;

                      import mx.events.ItemClickEvent;

                      import mx.rpc.Fault;

                      import mx.rpc.events.FaultEvent;

                     

                      import flash.display.Sprite;

                      import flash.events.ErrorEvent;

                      import flash.events.MouseEvent;

           

                     

             

                     

                 

                      private function closeHandler(evt:DropdownEvent):void {

                          myLabel.text = ComboBox(evt.target).selectedItem.labeltext;

                      }

                     

                     

                      private function loadLayerName():void

                      {

                        

                          myLegend.layers = null;

                          layerPanel.removeAllChildren();

                     

                          //loop through each layer and add as a radiobutton

                          for(var i:uint = 0; i < (dynamicLayer.layerInfos.length); i++)

                          {

                              var radioBtn:RadioButton = new RadioButton;

                              radioBtn.groupName = "radioBtnGroup";

                              radioBtn.value = i;

                              radioBtn.label = dynamicLayer.layerInfos[i].name;

                         

                              if (dynamicLayer.layerInfos[i].name == "Direct Impact (Million $)")

                              {

                                  radioBtn.label = "Direct Impact";

                                 

                              }

                              else if (dynamicLayer.layerInfos[i].name == "Total Impact (Million $)")

                              {radioBtn.label = "Total Impact";

                              }

                              else if (dynamicLayer.layerInfos[i].name == "Total Impact (Jobs)")

                              {radioBtn.label = "Total Impact";

                              }

                              else if (dynamicLayer.layerInfos[i].name == "Direct Impact (Jobs)")

                              {radioBtn.label = "Direct Impact";

                              }

                              else

                              {radioBtn.visible= false;

                              }

                                 

                              layerPanel.addChild(radioBtn);

                          /*     myDividerBox.getDividerAt(0).visible = false; */

                             

                             

                          }

                         

                          //set the visible layer the first radio button

                           radioBtnGroup.selectedValue = 0;

                           dynamicLayer.visibleLayers = new ArrayCollection([0]);

                          myLegend.layers = [dynamicLayer];

                          myLegend.visible = true;

                      }

                     

                      private function radioClickHandler(event:ItemClickEvent):void

                      {

                          myLegend.layers = null;

                          // update the visible layers to only show the layer selected

                          dynamicLayer.visibleLayers = new ArrayCollection([event.index]);

                          myLegend.layers = [dynamicLayer];

                      }

                     

                     

                 

                      private function changeEvt(event:Event):void {

                         

                         

                         

                      if (yearcombo.selectedItem.year == "2007")

                      {

                         

                          measures.filterFunction=filter1

                          measures.refresh()

                          myURL.dataProvider=measures

                         

                     

                      }

                      else if (yearcombo.selectedItem.year == "2009")

                         

                      {

                          measures.filterFunction=filter2

                          measures.refresh();

                      

                         

                          }

                     

                      }

                     

                     

                  public function filter1(item:Object):Boolean

                      {

                      if (item.year=="2007") return true

                      else return false

                      }

                     

                      public function filter2(item:Object):Boolean

                      {

                          if (item.year=="2009") return true

                          else return false

                         

                      }

                 

                     

                      private function clickEvt(event:Event):void {

                         

                         

                         

                          if (yearcombo.selectedItem.year == "2007")

                          {

                             

                              measures.filterFunction=filter3

                              measures.refresh()

                              myURL.dataProvider=measures

                             

                             

                          }

                          else if (yearcombo.selectedItem.year == "2009")

                             

                          {

                              measures.filterFunction=filter4

                              measures.refresh();

                             

                             

                          }

                         

                      }

                     

                     

                     

                     

                     

                      public function filter3(item:Object):Boolean

                      {

                          if (item.year=="2007") return true

                          else return false

                      }

                     

                      public function filter4(item:Object):Boolean

                      {

                          if (item.year=="2009") return true

                          else return false

                         

                      }

                     

                     

                      private function clickEv2(event:Event):void {

                         

                         

                         

                          if (yearcombo.selectedItem.year == "2007")

                          {

                             

                              measures.filterFunction=filter5

                              measures.refresh()

                         

                             

                             

                          }

                          else if (yearcombo.selectedItem.year == "2009")

                             

                          {

                              measures.filterFunction=filter6

                              measures.refresh();

                             

                             

                          }

                         

                          else if (yearcombo.selectedItem.year == 2007 && myURL.selectedIndex==8)

                          {

                              myLegend.layers = null;

                              layerPanel.removeAllChildren();

                             

                          }

                         

                      }

                     

                     

                     

                     

                     

                      public function filter5(item:Object):Boolean

                      {

                          if (item.year=="2007") return true

                          else return false

                      }

                     

                      public function filter6(item:Object):Boolean

                      {

                          if (item.year=="2009") return true

                          else return false

                         

                      }

                     

                     

                      /* IF YOU WANT TO INCLUDE OTHER VALUES IN THE MAP TOOLTIP LIKE COUNTY NAME AND THE LABEL OF THE SELECTED ITEM

                      if (myURL.selectedIndex==0)

                      {

                      myTextArea.htmlText = "<b>County: </b>" + gr.attributes.NAME + "\n"

                      + "<b>Measure: </b>" + myURL.selectedItem.label + gr.attributes.ForDirIndOut.toString()

                     

                      }     */       

                     

                     

                     

                      public function fLayer_graphicAddHandler(event:GraphicEvent):void

                      {

                          event.graphic.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);

                          event.graphic.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutHandler);

                 

                      }

                     

                      public function onMouseOverHandler(event:MouseEvent):void

                      {

                         

                         

                          if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                              textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()

                              myMap.infoWindow.content=textArea

                              myMap.infoWindow.label = graphic.attributes.NAME;

                              myMap.infoWindow.closeButtonVisible = false;

                              myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                                 

                             

                             

                          }       

                         

                          if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                                  textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()

                                  myMap.infoWindow.content=textArea

                                  myMap.infoWindow.label = graphic.attributes.NAME;

                                  myMap.infoWindow.closeButtonVisible = false;

                                  myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                             

                             

                             

                          }       

                          if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                                  textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()

                                  myMap.infoWindow.content=textArea

                                  myMap.infoWindow.label = graphic.attributes.NAME;

                                  myMap.infoWindow.closeButtonVisible = false;

                                  myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                             

                             

                             

                          }

                         

                         

                          if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                                  textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()

                                  myMap.infoWindow.content=textArea

                                  myMap.infoWindow.label = graphic.attributes.NAME;

                                  myMap.infoWindow.closeButtonVisible = false;

                                  myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                             

                             

                             

                          }

                         

                         

                         

                         

                         

                          if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                                  textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()

                                  myMap.infoWindow.content=textArea

                                  myMap.infoWindow.label = graphic.attributes.NAME;

                                  myMap.infoWindow.closeButtonVisible = false;

                                  myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                             

                             

                             

                          }

                         

                         

                          if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                                  textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()

                                  myMap.infoWindow.content=textArea

                                  myMap.infoWindow.label = graphic.attributes.NAME;

                                  myMap.infoWindow.closeButtonVisible = false;

                                  myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                             

                             

                             

                          }

                         

                         

                         

                         

                         

                          if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 3 )

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                                  textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()

                                  myMap.infoWindow.content=textArea

                                  myMap.infoWindow.label = graphic.attributes.NAME;

                                  myMap.infoWindow.closeButtonVisible = false;

                                  myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                             

                             

                             

                          }

                         

                         

                         

                          if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                                  textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()

                                  myMap.infoWindow.content=textArea

                                  myMap.infoWindow.label = graphic.attributes.NAME;

                                  myMap.infoWindow.closeButtonVisible = false;

                                  myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                             

                             

                             

                          }       

                         

                          if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                                  textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()

                                  myMap.infoWindow.content=textArea

                                  myMap.infoWindow.label = graphic.attributes.NAME;

                                  myMap.infoWindow.closeButtonVisible = false;

                                  myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                             

                             

                             

                          }       

                          if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                                  textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()

                                  myMap.infoWindow.content=textArea

                                  myMap.infoWindow.label = graphic.attributes.NAME;

                                  myMap.infoWindow.closeButtonVisible = false;

                                  myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                             

                             

                             

                          }

                         

                         

                          if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                                  textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()

                                  myMap.infoWindow.content=textArea

                                  myMap.infoWindow.label = graphic.attributes.NAME;

                                  myMap.infoWindow.closeButtonVisible = false;

                                  myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                             

                             

                             

                          }

                         

                         

                         

                         

                         

                          if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                                  textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()

                                  myMap.infoWindow.content=textArea

                                  myMap.infoWindow.label = graphic.attributes.NAME;

                                  myMap.infoWindow.closeButtonVisible = false;

                                  myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                             

                             

                             

                          }

                         

                         

                          if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                                  textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()

                                  myMap.infoWindow.content=textArea

                                  myMap.infoWindow.label = graphic.attributes.NAME;

                                  myMap.infoWindow.closeButtonVisible = false;

                                  myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                             

                             

                             

                          }

                         

                         

                         

                         

                         

                          if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 3 )

                          {

                              fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"

                             

                              var graphic:Graphic = Graphic(event.currentTarget);

                              graphic.symbol = mouseOverSymbol;

                              var htmlText:String = graphic.attributes.htmlText;

                              var textArea:TextArea = new TextArea();

                             

                              try{

                                  textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()

                                  myMap.infoWindow.content=textArea

                                  myMap.infoWindow.label = graphic.attributes.NAME;

                                  myMap.infoWindow.closeButtonVisible = false;

                                  myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}

                             

                              catch(error:Error) {

                                  trace("Caught Error: "+error);

                              }

                             

                             

                             

                          }

                         

                         

                     

                         

                      }

                     

                      public function onMouseOutHandler(event:MouseEvent):void

                      {

                          var gr:Graphic = Graphic(event.target);

                          gr.symbol = defaultsym;

                          myMap.infoWindow.hide();

                      }

                     

                     

           

                  ]]>

                 

                 

                 

                 

              </fx:Script>

             

              <fx:Style>

                  @namespace esri "http://www.esri.com/2008/ags";

                  @namespace s "library://ns.adobe.com/flex/spark";

                  @namespace mx "library://ns.adobe.com/flex/mx";

                  @namespace esri "http://www.esri.com/2008/ags";

                  @namespace components "com.esri.ags.components.*";

                 

                  components|InfoWindow

                  {

                      content-background-alpha : 0.4;

                      background-color : #4A7138;

                      background-alpha : 0.7;

                      border-style : solid;

                  }

              </fx:Style>

             

             

             

              <mx:HBox   width="930" height="800"  id="mapHbox"  horizontalAlign="center" >   

              <mx:HBox width="80">

                 

              </mx:HBox>

              <mx:HBox id="myHBox" width="800" height="600" backgroundColor="0xffffff"  >

                 

                 

                  <mx:VBox  height="590" width="358"  >

                     

                     

                  <!--    <mx:Panel

                          width="356" height="100%"

                          color="0x000000"

                          borderAlpha="0.15"

                         

                          >

                          -->

                     

                         

                         

                          <mx:Canvas height="100%" width="100%" backgroundColor="0xffffff" >

                              <esri:Map id="myMap" openHandCursorVisible="false"

                                        height="100%" 

                                        logoVisible="false"

                                        doubleClickZoomEnabled="false"

                                        scrollWheelZoomEnabled="false"

                                        zoomSliderVisible="false"

                                        scaleBarVisible="false" scale="4000000" >

                 

                                 

                             

                                 

                                  <esri:extent>

                                      <esri:Extent xmin="-10736651.061900" ymin="4024099.909700" xmax="-10409195.669800" ymax="3440153.831100"      >

                                          <esri:SpatialReference wkid="102100"/>

                                      </esri:Extent>

                                  </esri:extent>

                                  <esri:ArcGISDynamicMapServiceLayer id="dynamicLayer2"

                                                                    

                                                                     url="http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/counties_layer/MapServer" />

                                  <esri:ArcGISDynamicMapServiceLayer id="dynamicLayer" name=" "

                                                                     alpha="1"

                                                                     load="loadLayerName()"

                                                             url="http://tfs-24279/ArcGIS/rest/services/{myURL.selectedItem.value}/MapServer"   />

                                  <esri:FeatureLayer id="fLayer"

                                                     graphicAdd="fLayer_graphicAddHandler(event)"

                                                     mode="snapshot"

                                                     outFields="*"

                                                     symbol="{defaultsym}"

                                                     url= "http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/feature_layer_0709_five/FeatureServer/ 0" />

                                 

                                 

                             

                                 

                     

                              </esri:Map>

                         

                          </mx:Canvas>

                  <!--    </mx:Panel>-->

                     

                  </mx:VBox>       

                  <mx:VBox  height="590" width="20"  >

                     

                     

                 

                  </mx:VBox>       

                     

                  <mx:Canvas height="500" width="400" backgroundColor="0xffffff"

                             horizontalScrollPolicy="off"

                             verticalScrollPolicy="off" >

                      <mx:VBox  width="420" height="50%" paddingLeft="5" paddingTop="10" paddingRight="10" paddingBottom="10"

                               verticalGap="8">

                         

                             

                          <mx:Form  >

                         

                             

                              <mx:FormItem label="Year        :"  >

                                  <mx:ComboBox   id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)"  >

                                      <mx:ArrayCollection id="year"  >

                                         

                                     

                                          <fx:Object label="2007"  year="2007" />

                                          <fx:Object label="2009"  year="2009" />

                                         

                                         

                                      </mx:ArrayCollection>

                                     

                                     

                                  </mx:ComboBox>

                                 

                              </mx:FormItem>

                             

                              <mx:FormItem label="Measure:">

                                  <mx:ComboBox   id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">

                                  <mx:ArrayCollection id="measures"   >

                                     

                                 

                                      <fx:Object id="forindout07" labeltext="Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007"  />

                                      <fx:Object id="foremp07" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />

                                      <fx:Object id="forlabinc07" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />

                                      <fx:Object id="forindbustax07" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />

                                      <fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009"  />

                                      <fx:Object id="foremp09" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />

                                      <fx:Object id="forlabinc09" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />

                                      <fx:Object id="forindbustax09" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />

                                      <fx:Object id="blank" label=" "  />

                                  </mx:ArrayCollection>

                                     

                             

                                     

                              </mx:ComboBox>

                             

                                     

                                              

                                     

                                 

                              </mx:FormItem>

                     

                             

                          </mx:Form>

                         

                         

                         

                          <mx:VBox  id="layerPanel" width="50%" height="8%" verticalGap="3" paddingLeft="17">

                             

                              <mx:RadioButtonGroup id="radioBtnGroup" itemClick="radioClickHandler(event)"  />

                          </mx:VBox>

                         

                         

                          <mx:VBox paddingLeft="17" height="50%" >

                             

                             

                         

                          <mx:Canvas  id="legendPanel" width="100%"  >

                              <mx:Label id="myLabel" text=" " fontWeight="bold" />

                              <esri:Legend id="myLegend"

                                           layers="{[dynamicLayer]}"

                                           map="{myMap}" visible="false"

                                           respectCurrentMapScale="false"/>

                             

                             

                             

                          </mx:Canvas>

                          <mx:TextArea width="275"  borderAlpha="0" height="200"  >

                              <mx:htmlText   >

                                 

                                  <![CDATA[<font size='11'><b>Note:</b> Counties in white indicate either no data is available for that measure or the data has been supressed due to confidentiality.</font>

                                 

                                 

                                  ]]>

                             

                                     

                                 

                              </mx:htmlText>

                          </mx:TextArea>

                          </mx:VBox>   

                         

                         

                      </mx:VBox>

                         

                         

                  </mx:Canvas>

              </mx:HBox>

              </mx:HBox>   

          </mx:Application>