<?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"> <s:layout> <s:VerticalLayout/> </s:layout> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.controls.RadioButton; import mx.events.ItemClickEvent; private function loadLayerName():void { layerPanel.removeAllChildren(); //loop through each layer and add as a radiobutton var aa:String = "ma" + yearURL.selectedItem.toString() + monthURL.selectedItem.toString(); for(var i:uint = 0; i < (dynamicLayer.layerInfos.length); i++) { if (aa = dynamicLayer.layerInfos.name); { var radioBtn:RadioButton = new RadioButton; radioBtn.groupName = "radioBtnGroup"; radioBtn.value = i; radioBtn.label = dynamicLayer.layerInfos.name; layerPanel.addChild(radioBtn); } } //set the visible layer the first radio button radioBtnGroup.selectedValue = 0; dynamicLayer.visibleLayers = new ArrayCollection([0]); } private function radioClickHandler(event:ItemClickEvent):void { // update the visible layers to only show the layer selected dynamicLayer.visibleLayers = new ArrayCollection([event.index]); } ]]> </fx:Script> <fxeclarations> <!-- --> </fxeclarations> <esri:Map id="myMap"> <esri:ArcGISDynamicMapServiceLayer id="dynamicLayer" load="loadLayerName()" url="http://219.246.47.247/ArcGIS/rest/services/{myURL.selectedItem}/MapServer" /> </esri:Map> <mx:ComboBox id="myURL" selectedIndex="0" horizontalCenter="0"> <fx:Array> <fx:String>day</fx:String> <fx:String>day5</fx:String> <fx:String>day10</fx:String> </fx:Array> </mx:ComboBox> <mx:ComboBox id="yearURL"> <fx:Array> <fx:String>2002</fx:String> <fx:String>2003</fx:String> <fx:String>2006</fx:String> </fx:Array> </mx:ComboBox> <mx:ComboBox id="monthURL"> <fx:Array> <fx:String>10</fx:String> <fx:String>11</fx:String> <fx:String>12</fx:String> <fx:String>01</fx:String> <fx:String>02</fx:String> <fx:String>03</fx:String> </fx:Array> </mx:ComboBox> <mx:Panel id="layerPanel" width="300" height="250" x="20" y="250" paddingLeft="20"> <mx:RadioButtonGroup id="radioBtnGroup" itemClick="radioClickHandler(event)"/> </mx:Panel> </s:Application>
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.