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>
xmlns:esri="http://www.esri.com/2008/ags"in the top most element?
<?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>
<?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>