My project involves a lot of mapservices containing many layers, having it all displayed in the livemaps widget is unpratical.My two goals are:1. customize the live maps widget to display once for every mapservice, instead of all in the same window/TOC.2. override the default layer visibility within the TOC.My ideal livemaps config would look like:
<livemaps>
<mapservice label="Map1" visibleLayers="streets,buildings" menu="Navigation" type="dynamic" visible="false" alpha="1" icon="com/esri/solutions/flexviewer/assets/images/icons/i_highway.png">http://arcserver/ArcGis/rest/services/Map1/MapServer</mapservice>
<mapservice label="Map2" visibleLayers="population" menu="Resources" type="dynamic" visible="false" alpha="1" icon="com/esri/solutions/flexviewer/assets/images/icons/i_highway.png">http://arcserver/ArcGis/rest/services/Map2/MapServer</mapservice>
</livemaps>
added 'menu' and 'visibleLayers' attributes<widget label="Live Maps" livemap="Map1" icon="com/esri/solutions/flexviewer/assets/images/icons/i_folder.png" menu="menuMap" config="com/esri/solutions/flexviewer/widgets/LiveMapsWidget.xml">com/esri/solutions/esa/widgets/LiveMapsWidget.swf</widget>
added attribute 'livemap'Below is a change in the LiveMapsWidget.mxml, rewriting the getLayers() method:
// in init()
layerRepeater.dataProvider = getLayers(/* xml attribute livemap */);
private function getLayers(livemap:String):Array
{
var layerArray:Array = new Array();
for(var i:Number = map.layerIds.length -1; i >= 0; i--)
{
var layer:Layer = map.getLayer(map.layerIds);
if(!(layer is GraphicsLayer) && layer.name == livemap) //** added this condition to filter for only livemap
layerArray.push(layer);
}
return layerArray;
}
Would it be possible to get the confid data xml attribute 'livemap' into the widget above? perhaps there is a better way of going about this??? 2. Looking into overriding which layers are visible by default I've come up empty. I'd have to modifiy the TOC object but am unsure exactly as to where it inherits the property from the mapservice. Any ideas here would be great.