Select to view content in your preferred language

Get WmsMapServiceLayer loaded in map

660
3
09-01-2010 12:45 PM
AlexanderMena
Deactivated User
Hi all, I am trying get a layer of type WMSMapServiceLayer loaded in the map using the actionscript class  "WMSMapServiceLayer.as" extended of the class DynamicMapServiceLayer with the following code:

for each (var layerId:String in map.layerIds) {
  var layer:Layer = map.getLayer(layerId);
}

but when I try to ask the type of layer (ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, WMSMapServiceLayer)

if(layer is ArcGISDynamicMapServiceLayer){

}else if(layer is ArcGISTiledMapServiceLayer){

}else if(layer is WMSMapServiceLayer){
//condition is not true when layer is WMSMapServiceLayer
}

The condition for the layer WMSMapServiceLayer is not true, even when the object layer is of type
"com.geospatialfocus.WMSMapServiceLayer (@11839479)".

Any suggestion to do it.

Note: The service wms load fine in the map, but I need to do some whit it.


Thanks a lot for your help.

Alexander Mena
Tags (2)
0 Kudos
3 Replies
DasaPaddock
Esri Regular Contributor
0 Kudos
AlexanderMena
Deactivated User
Thanks Dasa, but it not worked for me.

I am working with "Flexviewer version 1.0 update 12-16-2009" and my method WidgetManager.loadWidget() this is:
info.load().
Then, I added the class WmsMapServiceLayer in the MapManager.config() as follows.

import com.geospatialfocus.WMSMapServiceLayer;

case "wms":
{
var wmslayer:WMSMapServiceLayer = new WMSMapServiceLayer(); 
wmslayer.url = url;
wmslayer.wmsLayer = wmsLayers;
wmslayer.id = label;
wmslayer.serviceName = label;
wmslayer.srs = "EPSG:"+map.spatialReference.wkid;
wmslayer.format= format;
wmslayer.visible = visible;     
wmslayer.alpha = alpha;
map.addLayer(wmslayer);
break;
      }
and so the condition in the other widget is now true.
It is great. All is working fine, but I don't understand why is it fine ?

I appreciate any reason.
0 Kudos
DasaPaddock
Esri Regular Contributor
By adding that code to the MapManager, you've made the WMSMapServiceLayer class definition exist in the main app's swf. When this main app loads widgets into child ApplicationDomains, the widgets first inherit all of the parents class definitions, so now your widgets are sharing the same definition.
0 Kudos