You can get all the layers by doing something like this
var layerArray:Array = new Array();
var mapLyrs:Array = map.layerIds.sort();
for(var i:Number = 0; i <= map.layerIds.length-1; i++)
{
var layer:Layer = map.getLayer(mapLyrs);
}
Then you can set layer.visible to turn layers on/off. Or if you know the name of your layer you can do something likemap.getLayer("LAYERNAME") where you set LAYERNAME in config.xml
<operationallayers>
<layer label="LAYERNAME" type="feature" visible="false" alpha="1"
url="http://url/to/layer/rest/service"/>
</operationallayers>
Additional Info:You can also check out the LayerList widget. Which will give you groups of layers provided they are in the same Feature Dataset on ArcServer end. So if you had a layer like this in your config.xml<layer label="NOAA Services" type="dynamic" visible="false" alpha="0.5"
url="http://publicsafetytemplates.esri.com/ArcGIS/rest/services/EMCOP/PublicSafetyFeedSample/MapServer"/>
It would show a collapsible list of all layers under that rest url. I hope that makes sense.