Select to view content in your preferred language

How can i GET visibleLayers ??

858
2
Jump to solution
02-10-2012 03:15 AM
aureliensebert
Emerging Contributor
in an application I try to save the layer properties (transparency, visible, etc. ..) but I can not retrieve visibleLayers from an ArcGISDynamicMapServiceLayer because visibleLayers is a method used to SET (not GET) the visible layers for the map service.
someone has an idea ?

      for each (var layer:Layer in map.layers)      {      if (layer is ArcGISDynamicMapServiceLayer){      var visLayers:Array =[];      //NOT WORK !!!!!      visLayers = ArcGISDynamicMapServiceLayer(layer).visibleLayers;          }          }


Aurélien SEBERT
CAUE DU NORD
FRANCE
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Aurélien,
  
   I don't think you are understanding the documentation.

http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/ArcGISDynamicMapServiceLayer.html

visibleLayers    property    
visibleLayers:ArrayCollection

Sets the visible layers of the exported map. By default, the visible layers are as defined by the default visibility in LayerInfo.

This property can be used as the source for data binding.

Implementation
    public function get visibleLayers():ArrayCollection
    public function set visibleLayers(value:ArrayCollection):void


So you can get the visibleLayers from the ArcGISDynamicMapServiceLayer as an ArrayCollection.

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
Aurélien,
  
   I don't think you are understanding the documentation.

http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/ArcGISDynamicMapServiceLayer.html

visibleLayers    property    
visibleLayers:ArrayCollection

Sets the visible layers of the exported map. By default, the visible layers are as defined by the default visibility in LayerInfo.

This property can be used as the source for data binding.

Implementation
    public function get visibleLayers():ArrayCollection
    public function set visibleLayers(value:ArrayCollection):void


So you can get the visibleLayers from the ArcGISDynamicMapServiceLayer as an ArrayCollection.
0 Kudos
aureliensebert
Emerging Contributor
thank you ... 🙂 it's work

I did not understand the documention --- French (or only me)  are bad in English

 for each (var layer:Layer in map.layers) 
    {
     if (layer is ArcGISDynamicMapServiceLayer){
     var visLayers:ArrayCollection = new ArrayCollection;
     
     visLayers = ArcGISDynamicMapServiceLayer(layer).visibleLayers;
     
     Alert.show(visLayers.source.join(","));
     
     // ex : result : 0,1,2,4,7,8
    } 
    
   }
0 Kudos