How do I Iterate/Loop through all layers of a map - load a dojo combox with Names.

Discussion created by tracileemt on Aug 3, 2010
Latest reply on Aug 3, 2010 by tracileemt
Hi All,
  I have added serveral layers to my map using id: as in the statement below.
I want to iterate/loop through the layers and if it is a visible layer add it to a dojo.combobox.
I have tried everything to loop through the layers unsuccessfully.
Can anyone please help.
Thanks Traci

var schools = new esri.layers.ArcGISDynamicMapServiceLayer("", { id: "School Districts", visible: true });