Davi, I missed that line. What is the concurrency of your myGeometryService set to?
Davi, Search your code for myGeometryService and find out is it declared in MXML or actionscript and verify if the concurrency="last" or what.
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:esri="http://www.esri.com/2008/ags" layout="absolute"> <esri:GeometryService id="myGeometryService" concurrency="multiple" bufferComplete="bufferCompleteHandler(event)" url="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/> <mx:Script> <![CDATA[ import com.esri.ags.events.GeometryServiceEvent; import com.esri.ags.layers.GraphicsLayer; import com.esri.ags.Graphic; import com.esri.ags.geometry.MapPoint; import com.esri.ags.tasks.BufferParameters; private function buttonClick(evt:MouseEvent):void { highlightStoresArea(-87.8658, 41.6694, 5); highlightStoresArea(-88.1995, 41.7070, 5); } public function highlightStoresArea(x:Number, y:Number, radius:Number):void { var myMapCenterPoint:Graphic = new Graphic(); myMapCenterPoint.geometry = new MapPoint(x, y, new SpatialReference(4326)); var bufferParameters:BufferParameters = new BufferParameters(); bufferParameters.features = [myMapCenterPoint]; bufferParameters.distances = [radius]; bufferParameters.unit = BufferParameters.UNIT_STATUTE_MILE; bufferParameters.bufferSpatialReference = new SpatialReference(4326); myGeometryService.buffer(bufferParameters); } private function bufferCompleteHandler(event:GeometryServiceEvent):void { myGraphicsLocationsLayer.add(event.graphics[0]); } ]]> </mx:Script> <esri:SimpleFillSymbol id="sfs" color="0xFF0000" alpha="1.0"> <esri:SimpleLineSymbol color="0x000000"/> </esri:SimpleFillSymbol> <esri:Map id="myMap"> <esri:extent> <esri:Extent xmin="-89.925" ymin="40.222" xmax="-83.894" ymax="42.205"> <esri:spatialReference> <esri:SpatialReference wkid="4326"/> </esri:spatialReference> </esri:Extent> </esri:extent> <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/> <esri:GraphicsLayer id="myGraphicsLocationsLayer" symbol="{sfs}" /> </esri:Map> <mx:Button click="buttonClick(event)" label="Buffer" /> </mx:Application>
Davi, Here is a complete application example:<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:esri="http://www.esri.com/2008/ags" layout="absolute"> <esri:GeometryService id="myGeometryService" concurrency="multiple" bufferComplete="bufferCompleteHandler(event)" url="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/> <mx:Script> <![CDATA[ import com.esri.ags.events.GeometryServiceEvent; import com.esri.ags.layers.GraphicsLayer; import com.esri.ags.Graphic; import com.esri.ags.geometry.MapPoint; import com.esri.ags.tasks.BufferParameters; private function buttonClick(evt:MouseEvent):void { highlightStoresArea(-87.8658, 41.6694, 5); highlightStoresArea(-88.1995, 41.7070, 5); } public function highlightStoresArea(x:Number, y:Number, radius:Number):void { var myMapCenterPoint:Graphic = new Graphic(); myMapCenterPoint.geometry = new MapPoint(x, y, new SpatialReference(4326)); var bufferParameters:BufferParameters = new BufferParameters(); bufferParameters.features = [myMapCenterPoint]; bufferParameters.distances = [radius]; bufferParameters.unit = BufferParameters.UNIT_STATUTE_MILE; bufferParameters.bufferSpatialReference = new SpatialReference(4326); myGeometryService.buffer(bufferParameters); } private function bufferCompleteHandler(event:GeometryServiceEvent):void { myGraphicsLocationsLayer.add(event.graphics[0]); } ]]> </mx:Script> <esri:SimpleFillSymbol id="sfs" color="0xFF0000" alpha="1.0"> <esri:SimpleLineSymbol color="0x000000"/> </esri:SimpleFillSymbol> <esri:Map id="myMap"> <esri:extent> <esri:Extent xmin="-89.925" ymin="40.222" xmax="-83.894" ymax="42.205"> <esri:spatialReference> <esri:SpatialReference wkid="4326"/> </esri:spatialReference> </esri:Extent> </esri:extent> <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/> <esri:GraphicsLayer id="myGraphicsLocationsLayer" symbol="{sfs}" /> </esri:Map> <mx:Button click="buttonClick(event)" label="Buffer" /> </mx:Application>
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.