<esri:QueryTask id="existingQueryTask" showBusyCursor="true" url="http://ArcGIS/rest/services/Test/BaseLayers/MapServer/3" /> <esri:Query id="exParkQuery" where="ParkId='{wRepeater.currentItem.ParkId}'" returnGeometry="true"> <esri:outFields>*</esri:outFields> </esri:Query>
<?xml version="1.0" encoding="utf-8"?> <s:Application name="Repeater Test" 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"> <fx:Script> <![CDATA[ import com.esri.ags.events.QueryEvent; import mx.controls.Alert; import mx.states.State; private function doQuery(event:Event):void { var state:String = arrList.getItemAt(event.currentTarget.repeaterIndex).toString(); var where:String = "STATE_NAME = '"+state+"'"; query.where = where; query.outFields = ["STATE_NAME"]; queryTask.addEventListener(QueryEvent.EXECUTE_COMPLETE, onQueryComplete); queryTask.execute(query); } private function onQueryComplete(result:QueryEvent):void { //Alert.show("done"); } ]]> </fx:Script> <fx:Declarations> <s:ArrayList id="arrList" source="[New York,California,Florida]"/> <esri:QueryTask useAMF="false" id="queryTask" showBusyCursor="true" url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5"/> <esri:Query id="query" outSpatialReference="{myMap.spatialReference}" returnGeometry="true"/> </fx:Declarations> <esri:Map id="myMap"> <esri:extent> <esri:Extent xmin="-14298000" 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:GraphicsLayer id="myGraphicsLayer" graphicProvider="{queryTask.executeLastResult.features}"/> </esri:Map> <s:VGroup horizontalCenter="0" verticalCenter="0"> <mx:HBox> <mx:Repeater id="rpt" dataProvider="{arrList}"> <s:Button click="doQuery(event)" left="20" top="335" label="{rpt.currentItem}" /> </mx:Repeater> </mx:HBox> </s:VGroup> </s:Application>
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.