Paul yes getting the map scale you use that method, its getting the Layer (and sublayer) visibilities that is, well, difficult.
For example:
Current Map scale 1:10000
1 Dynamic Layer with 3 sublayers (a,b,c)
a - visible all the time
b - turns on at 1:15000
c - turns on at 1:5000
Most of us would prefer this displayed ArcMAP style where the group (1) indicates some layers arent drawing
so:
1 (symbolize some not drawing)
- a - (symbolize as visible)
- b - (symbolize as checked and visible, but would turn off if you zoom out)
- c - (symbolize as checked, but not visible due to scale)
unfortunately to get the info about the sublayers you need to make a separate query to the MapService to get the layer properties. You also either need to store this info (per layer) and check it when the scale changes (onzoomin, onzoomout) or you need to make queries everytime.