I have a layer that contains two clipping groups (groups with a clip mask and other art). When I call layer.groupItems it returns an empty array. When I call layer.layers it returns the two clipping groups. I need to know if these layers are clipping groups, but if they are coming back as layers how can I figure that out?

I'm just not getting warm fuzzies over this api. It seems very broken. I would expect the results you are getting, but why my results are different baffles me.

The dupe layer question is also ActionScript, but after perusing these forums it seems it's a known issue that z-ordering is broken in this api. There is no way to reliably get the correct z-order for elements in a layer.