Justin,
Here is what needs to be done for FlexViewer 2.x
MapManager.mxml is the only file to be changed and two functions need to be altered.
This code is developed for combining two basemap layers called "Places" and "Aerial"://basemap menu clicked private function basemapMenuClicked(event:AppEvent):void { var id:String = event.data as String; var configBasemaps:Array = configData.basemaps; if (id) { var BaseMapChoosen:String = ""; var lyrNames:Layer = map.getLayer("Places"); for (var i:Number = 0; i < configBasemaps.length; i++) { var label:String = configBasemaps.label; var lyr:Layer = map.getLayer(label); if (lyr != null) { if (configBasemaps.id == id) { lyr.visible = true; BaseMapChoosen = configBasemaps.label } else { lyr.visible = false; } if(lyrNames){ if(BaseMapChoosen == "Aerial") { lyrNames.visible = true; }else{ lyrNames.visible = false; } } } } } } private function configBasemaps():void { var i:int = 0; for (i = 0; i < configData.basemaps.length; i++) { if (i == configData.basemaps.length - 1) { map.addEventListener(MapEvent.LAYER_ADD, layerloadComplete); } addLayerToMap(configData.basemaps, false); } // remove the excluded basemaps var shownBaseMaps:Array = configData.basemaps.slice(); for (var n:Number = 0; n < shownBaseMaps.length; n++) { if (shownBaseMaps.label == "Places") shownBaseMaps.splice(n, 1); } configData.basemaps = shownBaseMaps; }
Using basemaps and operational layers <basemaps> - List of map services used as a base map in the Viewer. Only one base map can be visible at a time, but a base map can consist of more than one layer. To create hybrid base map, set the name property to be the same on all the layers in the basemaps group that should make up the hybrid base map. When multiple map services are listed in <basemaps>, the Map Switcher widget can be used to enable end users to switch between them. <basemaps> has one child tag that can be repeated multiple times:
- <layer> - This is a map service displayed as a layer in the Viewer. See Layer tag topic for information on its attributes.
Adi,
All of this code was for older versions of the viewer... In the Flex Viewer now all you have to do to combine two base maps is to give them identical labels in the main config.
from: http://help.arcgis.com/en/webapps/flexviewer/help/index.html#/Main_configuration_file/01m30000001800...