Layer On/Off

585
3
02-08-2011 09:50 AM
MayJeff
Occasional Contributor
I would like to use the same button to turn on/off a layer instead of showing 2 buttons.  I attached the code below.  Please help.  Thank you.
Tags (2)
0 Kudos
3 Replies
MitchKoyle
New Contributor
If you want to toggle the the visibility for two layers, you could try using a visible flag and have each layer use that flag to toggle their visible property. Please note that this will work fine for two layers, but if you need to toggle the visibility for more than two layers, you might need something similar to the 'Switching Basemaps'  sample.

I have modified your file and attached it to show you what I mean.
0 Kudos
MayJeff
Occasional Contributor
Thank you very much.  It works 🙂
0 Kudos