No prob...
Disclaimer: This app is a custom app, not built within the flex template.
I have a property in my config file for each layer in my app called legendGroup. This property contains a comma delimited list of layerIds that participate in the "group". For example, say I have a group layer in my MXD with a layerId of 5, and it's children are layers 6, 7, 8. Each of the children have scale dependencies such that only one of them is visible at any given time and I want my legend to reflect only the visible layer. The layer in my config file would have a legendGroup property = "6,7,8".
While building my legend, I pass the legendGroup property and current map scale of the layer of interest to my legend class. I then loop through the JSON results from the legend REST endpoint and find all the layerIds that match one of the layers within my legendGroup. I then loop through the 3 layers that match and compare the legend scale to the map scale I originally passed in. At this point I can confidently pass the "appropriate" legend data back for further processing.
The cons to this solution is you have to manually configure your application to tell it which layers participate in the legend group... but on the flip side you can add as many layers to the group as you want whether they participate in a group layer in the MXD or not, and you always get the legend data for the visible layer in the group.
Make sense?