Is there any way to achieve Z Ordering on more than just siblings

Is there any way to achieve Z Ordering on more than just siblings
0

I’m trying to create a dropdown button. The concept is pretty simple - a normal button that has a child that is set to be visible when the button is pressed. This dropdown button is part of a Settings dialog (vertical top-to-bottom in this case). The desired outcome here is that the dropdown part that appears should be rendered on top of things that are below it. Since the rendering happens top-to-bottom (in the hierarchy), the outcome is obviously different:


Is there any way to make the ‘English’ button (which is a child of the ‘Language’ button) appear on top of the credits button? This is the hierarchy:
Screenshot_41

as a quick fix, when the open combobox button is pressed, you could manually set the z index of the Mask node to the max, so that it will be on top of everything

Mask.zIndex = cc.macro.MAX_ZINDEX;

I’ve tried that and it doesn’t work. However, I figured out a way to do it and still be able to display stuff on top of the mask: let the layout to be bottom-to-top (and reverse the children’s order). It will look exactly the same but now Credits is rendered before the Mask, so it appears on top. And considering the Global Z order is completely deprecated, I think this is the best solution. It wouldn’t work if the Dropdown extended both ways but it’s ok for this purpose.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.