Select to view content in your preferred language

Setting alpha on individual layers

692
2
07-13-2010 09:10 AM
BrendanLee
Emerging Contributor
Is there a way to set the alpha on individual layers?
In the code below I would like to set the alpha for the first 2 to 100% and the 3rd to 60%.

<esri:ArcGISDynamicMapServiceLayer id="ElemZones" 
   url="http://myServer/ArcGIS/rest/services/public/Schools/MapServer"
   show="layerShowHandler(event)" alpha=".5"
   visible="{bb.selectedIndex == 1}"> 
     <esri:visibleLayers>
                <mx:ArrayCollection>
                 <mx:Number>3</mx:Number>
                  <mx:Number>4</mx:Number>
                  <mx:Number>5</mx:Number>
               </mx:ArrayCollection>
     </esri:visibleLayers>       
</esri:ArcGISDynamicMapServiceLayer>
Tags (2)
0 Kudos
2 Replies
GregKnight
Deactivated User
I think the way to approach this is to use 2 dynamic layers -- setting the alpha and visibility accordingly.  Something like:

<esri:ArcGISDynamicMapServiceLayer id="ElemZones1" 
   url="http://myServer/ArcGIS/rest/services/public/Schools/MapServer"
   show="layerShowHandler(event)" alpha="1"
   visible="{bb.selectedIndex == 1}"> 
     <esri:visibleLayers>
                <mx:ArrayCollection>
                 <mx:Number>3</mx:Number>
                  <mx:Number>4</mx:Number>
               </mx:ArrayCollection>
     </esri:visibleLayers>       
</esri:ArcGISDynamicMapServiceLayer>

<esri:ArcGISDynamicMapServiceLayer id="ElemZones2" 
   url="http://myServer/ArcGIS/rest/services/public/Schools/MapServer"
   show="layerShowHandler(event)" alpha=".6"
   visible="{bb.selectedIndex == 1}"> 
     <esri:visibleLayers>
                <mx:ArrayCollection>
                  <mx:Number>5</mx:Number>
               </mx:ArrayCollection>
     </esri:visibleLayers>       
</esri:ArcGISDynamicMapServiceLayer>
0 Kudos
BrendanLee
Emerging Contributor
Thanks for the reply. That's the approach I ended up using. I was just looking for a "cleaner" way to do it.
0 Kudos