I need to do this in the scripting environment (not xml).
Would you know why the myLayer variable (in the code above) does not offer a "visibleLayers" property while the thisLayer variable does have a "visibleLayers" property even though both were defined as ArcGISDynamicMapServiceLayer type variables?