<?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"
minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import com.esri.ags.events.LayerEvent;
import com.esri.ags.layers.GraphicsLayer;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
// the following four functions are 'just' error handling and showing/hiding the busy cursor
protected function fLayer_updateStartHandler(event:LayerEvent):void
{
this.cursorManager.setBusyCursor();
}
protected function fLayer_updateEndHandler(event:LayerEvent):void
{
var ac:ArrayCollection = fLayer.graphicProvider as ArrayCollection;
var gl:GraphicsLayer = new GraphicsLayer();
gl.graphicProvider = ac;
myMap.addLayer(gl);
fLayer.visible = false;
this.cursorManager.removeBusyCursor();
}
]]>
</fx:Script>
<esri:Map id="myMap">
<esri:extent>
<esri:Extent xmin="-14305000" ymin="2748000" xmax="-6815000" ymax="7117000">
<esri:SpatialReference wkid="102100"/>
</esri:Extent>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer"/>
<esri:FeatureLayer id="fLayer"
mode="snapshot"
updateEnd="fLayer_updateEndHandler(event)"
updateStart="fLayer_updateStartHandler(event)"
url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/FeatureServer/0"/>
</esri:Map>
</s:Application>