Hi,I am trying to have make an application where the user can turn on/off the dynamiclayer of a mapservice. A very small question regarding this.In my config file I have set 1 of the 2 layers visible using the visiblelayers property: <operationallayers> <layer label="gpsTrack" type="dynamic" visible="true" visiblelayers="1" url="http://176.34.114.255/ArcGIS/rest/services/fleetPoc/FleettracksJanLeen/MapServer"/> </operationallayers>
Then, in my mxml of my widget, I want that the user, once he checks an option of a dropdownlist, he can see that layer visible. There are only two layers. At startup, I put "1" visible (as mentioned above), but then the user should be able to make the second one visible (and the first one invisible) and vice versa. I do not think it can be very difficult, but the issue is that in my mxml, he does not recognize the property 'visiblelayers'.protected function myDDL_changeHandler(event:IndexChangeEvent):void { var dyn:ArcGISDynamicMapServiceLayer= map.getLayer("gpsTrack") as ArcGISDynamicMapServiceLayer; var visLayers:ArrayCollection = dyn.visibleLayers; if (myDDL.selectedItem.subject == "Track") { visLayers.removeItemAt(2); visLayers.addItem(1); dyn.visibleLayers=visLayers; dyn.refresh(); } else if (myDDL.selectedItem.subject == "Elevation") { visLayers.removeItemAt(1); visLayers.addItem(2); dyn.visibleLayers=visLayers; dyn.refresh(); } However, the compiler gives an error: "RangeError: Index '1' specified is out of bounds." But my service has the following layers: VehicleTracks (0) Tracks (1) TracksElevation (2)Any tips to resolve this issue?Thanks a lot in advance!Kindly,Leen