private function editLayerStart(event:FeatureLayerEvent):void { event.preventDefault(); }
(EditorSkin)(myEditor.getChildAt(0)).currentState = "normal"
<?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" initialize="application_initializeHandler(event)"> <s:layout> <s:HorizontalLayout/> </s:layout> <fx:Style> @namespace esri "http://www.esri.com/2008/ags"; esri|Editor { skin-class: ClassReference("assets.skins.EditorSkin"); /* undo/redo buttons commented */ } </fx:Style> <fx:Script> <![CDATA[ import com.esri.ags.components.Editor; import com.esri.ags.events.FeatureLayerEvent; import com.esri.ags.tasks.GeometryService; import mx.events.FlexEvent; private var myEditor:Editor; private var geometryService:GeometryService = new GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); protected function application_initializeHandler(event:FlexEvent):void { myEditor = new Editor(); myEditor.map = myMap; myEditor.featureLayers = [ points, fireAreas ]; myEditor.geometryService = geometryService; myEditor.toolbarVisible = true; editorHolder.addElement(myEditor); } protected function editsStartingHandler(event:FeatureLayerEvent):void { var addingDisabled:Boolean = Math.random() > 0.5; if (event.adds && event.adds.length > 0 && addingDisabled && event.cancelable) { event.preventDefault(); editorHolder.removeAllElements(); myEditor = new Editor(); myEditor.map = myMap; myEditor.featureLayers = [ points, fireAreas ]; myEditor.geometryService = geometryService; myEditor.toolbarVisible = true; editorHolder.addElement(myEditor); } } ]]> </fx:Script> <s:VGroup width="328" height="100%" id="editorHolder" /> <esri:Map id="myMap" wrapAround180="true"> <esri:extent> <esri:Extent id="sheepfire" xmin="-13144000" ymin="4033000" xmax="-13066000" ymax="4099000"> <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" editsStarting="editsStartingHandler(event)" mode="snapshot" outFields="*" url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Fire/Sheep/FeatureServer/2"/> <esri:FeatureLayer id="points" mode="snapshot" editsStarting="editsStartingHandler(event)" outFields="*" url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Fire/Sheep/FeatureServer/0"/> </esri:Map> </s:Application>
FeatureLayerEvent () Constructor public function FeatureLayerEvent(type:String, featureLayer:FeatureLayer = null, cancelable:Boolean = false) Creates a new FeatureLayerEvent. Parameters type:String â?? The event type; indicates the action that triggered the event. featureLayer:FeatureLayer (default = null) â?? Reference to the associated layer. cancelable:Boolean ( default = false) â?? Specifies whether the behavior associated with the event can be prevented.
protected function onSmthingChange(event:SmthingChangeEvent):void { dispatchEvent(new FeatureLayerEvent(FeatureLayerEvent.EDITS_STARTING, myFeatureLayer, true); } protected function editLayerStart(event:FeatureLayerEvent):void { if (event.cancelable) { event.preventDefault(); } else { // undo only } }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.