Select to view content in your preferred language

Basemap switch with change in map scale.

2596
4
07-27-2011 01:19 PM
HenryMoore
New Contributor II
Is it difficult to use scale dependancy to switch between Street_Map, Imagery, and topo's in the new Flex Viewer 2.3.1? I would like to leave StreetMap visible on initial extent w/option of switching to topo's but automatically go to aerial imagery when zoomed in beyond visible extent of StreetMap or topo. I know in previous versions of the viewer this was handled in the MapManager.mxml code using  the following:

private function checkScale(evt:Event):void
{
var tl:ArcGISTiledMapServiceLayer;
//If ESRI Street maps <9000 Turn off ESRI Street map and switch to imagery.
  if(map.scale < 9000)
{
tl = map.getLayer("Street Map") as ArcGISTiledMapServiceLayer;
tl.visible = false;
tl = map.getLayer("Satellite Map") as ArcGISTiledMapServiceLayer;
tl.visible = true;
}
if(map.scale > 9000)
{
tl = map.getLayer("Street Map") as ArcGISTiledMapServiceLayer;
tl.visible = true;
tl = map.getLayer("Satellite Map") as ArcGISTiledMapServiceLayer;
tl.visible = false;
}
}
Tags (2)
0 Kudos
4 Replies
HenryMoore
New Contributor II
Thanks Robert Scheitlin! I added the following to the "private function config(event:AppEvent):void"
and the code worked fine.

map.addEventListener(ZoomEvent.ZOOM_END, checkScale);
0 Kudos
BeckyCarr
New Contributor II
How would this be accomplished in 2.5?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Becky,

   This can all be done using the eMapSwitcher widget now. Just read the readme.txt for details.

http://www.arcgis.com/rc/item.html?id=7156b0acf6574f848ddfd3d7e155746b

Don't forget to click the top arrow (promote) as shown below:
0 Kudos
BeckyCarr
New Contributor II
Works great!  Thank you.
0 Kudos