Select to view content in your preferred language

Dynamic_TOC sample - get "visible" layers array

661
3
11-09-2010 08:26 AM
MatthewStarry
Occasional Contributor
Using the Dynamic_TOC (Dynamic Map Layers on/off) sample...
http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=Dynamic_TOC

How could I get the array of visible layers as set in the TOC and use it in the application code?

From my understanding, the layerInfos variable in the LayerTOC.mxml component gets updated when the user checks or unchecks the box next to the layer name.  I would want to use that variable in the Dynamic_TOC.mxml application code.

This is probably simple but I would really appreciate any help/direction.  Thanks!
Tags (2)
0 Kudos
3 Replies
DasaPaddock
Esri Regular Contributor
You can get the list of visible layers from the layer itself at:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/ArcGISDynamicMapServiceLayer.html#v...

If you still need access to LayerTOC.layerInfos, you can make it public.
0 Kudos
MatthewStarry
Occasional Contributor
You can get the list of visible layers from the layer itself at:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/ArcGISDynamicMapServiceLayer.html#v...


Thanks, Dasa.  I managed to figure out the syntax for getting the visible layers array collection and using it as an array.  I'm learning this stuff as I go.:)
0 Kudos
RichardKrell
Emerging Contributor
Matthew,
I was reading this thread and like you I am new at this and was wondering if you could pass on the code that you wrote that resolved this issue.

Thanks in advanne
Richard Krell
0 Kudos