<mx:HBox left="500" top="5"> <mx:Button id="map1Button" label="Street Map" click="setBasemap('Street Map')" /> <mx:Button id="map2Button" label="Satellite Map" click="setBasemap('Satellite Map')" /> </mx:HBox>
private function setBasemap(basemap:String):void { var lyr:Layer = SiteContainer.getInstance().controller.map.getLayer("Street Map"); var lyr2:Layer = SiteContainer.getInstance().controller.map.getLayer("Satellite Map"); if (basemap == "Street Map"){ lyr.visible = true; lyr2.visible = false; }else if (basemap == "Satellite Map"){ lyr.visible = false; lyr2.visible = true; } }
private function setBasemap(basemap:String):void { var lyr:Layer = SiteContainer.getInstance().controller.map.getLayer("Leaf Collection Map"); var lyr2:Layer = SiteContainer.getInstance().controller.map.getLayer("Recycle Collection Map"); var lyr3:Layer = SiteContainer.getInstance().controller.map.getLayer("Garbage Collection Map"); switch(basemap) { case "Leaf Collection Map": { lyr.visible = true; lyr2.visible = false; lyr3.visible = false; break; } case "Recycle Collection Map": { lyr.visible = false; lyr2.visible = true; lyr3.visible = false; break; } case "Garbage Collection Map": { lyr.visible = false; lyr2.visible = false; lyr3.visible = true; break; } } }