weather undergound widget

872
2
Jump to solution
01-24-2012 04:35 AM
philippschnetzer
Occasional Contributor III
Is it possible to hide the icons from the weather underground widget when zoomed out beyond a certain scale?  I am using this widget completely in the background and not giving the user any ability to control it....but I find when zoomed out too far the icons clutter the map....

I've made an attempt to do this in the code but do not feel like posting my pathetic erroneous attempt...

Thanks!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Phillip,

   All you need to do is add this right after map.addLayer(graphicsLayer) in the init function and adjust the 40000 to your preferred scale:

                map.addEventListener(ZoomEvent.ZOOM_END, checkScale);                 if(map.scale > 40000)                     graphicsLayer.visible = false;


Add this import:

import com.esri.ags.events.ZoomEvent;


And this new function:

private function checkScale(evt:Event):void             {                 if(map.scale > 40000){                     graphicsLayer.visible = false;                 }else{                     graphicsLayer.visible = true;                 }             }

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
Phillip,

   All you need to do is add this right after map.addLayer(graphicsLayer) in the init function and adjust the 40000 to your preferred scale:

                map.addEventListener(ZoomEvent.ZOOM_END, checkScale);                 if(map.scale > 40000)                     graphicsLayer.visible = false;


Add this import:

import com.esri.ags.events.ZoomEvent;


And this new function:

private function checkScale(evt:Event):void             {                 if(map.scale > 40000){                     graphicsLayer.visible = false;                 }else{                     graphicsLayer.visible = true;                 }             }
0 Kudos
philippschnetzer
Occasional Contributor III
Perfect!  Thanks, Robert!
0 Kudos