Make ArcGISDynamicMapServiceLayer Invisible,Low Opacity or Transparent at Scale Level

Discussion created by serp356 on Aug 9, 2012
Latest reply on Aug 10, 2012 by JGravois-esristaff
I have a  ArcGISDynamicMapServiceLayer that I only want to make it visible when you get higher than scale 4 in the map as defined by my ArcGISTiledMapServiceLayer and I can't find a good way to do this.  I have it so that the layers aren't visible in mxd at these scales but I had to use a nontransparent ImageFormat to get the detail I wanted in the layer.  I think I'm almost there, code excerpts are below. 

dojo.connect(map, "onExtentChange", LayerVisible)

function LayerVisible(extent, delta, outLevelChange, outLod) {        
if(outLod.level > 4) {                 }}

I want to use something like MyLayer.setOpacity(0) inside the brackets but I can't seem to pass the MyLayer properly to a function or access it from within the function without passing it.

Can anyone help me or tell me how else to make an entire dynamicservicelayer not show at a certain scale.