<?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" initialize="application1_initializeHandler(event)" pageTitle="Editor with all toolbar options"> <!-- This sample shows you how to use the editor component with a full toolbar. --> <fx:Style> @namespace esri "http://www.esri.com/2008/ags"; esri|InfoWindow { background-color : #FFFFFF; border-thickness : 2; } </fx:Style> <fx:Script> <![CDATA[ import com.esri.ags.components.supportClasses.CreateOptions; import com.esri.ags.tasks.GeometryService; import com.esri.ags.tools.DrawTool; import com.esri.ags.tools.EditTool; import mx.events.FlexEvent; protected function application1_initializeHandler(event:FlexEvent):void { myEditor.featureLayers = [ fireAreas ]; var myDrawTypePreferences:CreateOptions = new CreateOptions(); // change the defauls drawing tool from "point-to-point" to "freehand" myDrawTypePreferences.polygonDrawTools = [ DrawTool.POLYGON, DrawTool.POLYLINE, CreateOptions.AUTO_COMPLETE ]; myEditor.createOptions = myDrawTypePreferences; } protected function myEditor_creationCompleteHandler(event:FlexEvent):void { var editTool:EditTool = myEditor.editTool; editTool.snapMode = EditTool.SNAP_MODE_ALWAYS_ON; editTool.allowAddVertices = false; editTool.allowDeleteVertices = false; } ]]> </fx:Script> <mx:VBox width="100%" height="100%"> <esri:Map id="map" wrapAround180="true"> <esri:extent> <esri:Extent id="sheepfire" xmin="14404817" ymin="-3626334" xmax="14991242" ymax="-3224581"> <esri:SpatialReference wkid="102100"/> </esri:Extent> </esri:extent> <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/> <esri:FeatureLayer id="fireAreas" mode="snapshot" outFields="*" url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Fire/Sheep/FeatureServer/2"/> </esri:Map> <esri:Editor id="myEditor" creationComplete="myEditor_creationCompleteHandler(event)" width="100%" geometryService="{new GeometryService('http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer')}" map="{map}" toolbarCutVisible="true" toolbarMergeVisible="true" toolbarReshapeVisible="true" toolbarVisible="true" /> </mx:VBox> </s:Application>