Overlay and display groups.

If I create a display group then show an overlay, the overlay gets displayed under the display group.

Most likely because the overlay scene uses scene.view and that is the default of the actual running scene.

Does anyone have an elegant solution so that the overlay will always be on top of the scene no matter how many display groups?

If overlay’s in display group then you can move it’s parent to front, but if you create new display group then new group will always be on top

I think maybe in the overlay scene, it would be best to create a new display group. I think that would work. Will try.

RESULT…

That doesn’t work. I think the overlay scene is its own group and by adding the graphics in the overlay into a new display.newGroup() its putting it outside of the scene.

Your observation is correct -objects or display groups can always be only in one other group (corona canvas (stage) is also counting as display group for objects inserted nowhere). Storyboard has it’s own group and overlay must also be there. So if you insert overlay inside other group then it’s transfered from storyboard and lost from it’s view

Have you tried :toFront() for your group but after creating scene?

I had a similar issue.  My issue was that I had a scene that had multiple native.textfields, which are always on top of other display objects.  Basically what I did was in the scene:overlayBegan function I moved all the textfields off the screen, then in scene:overlayEnded I moved them back to their original position.  This might be an option for you with the display group.  

If overlay’s in display group then you can move it’s parent to front, but if you create new display group then new group will always be on top

I think maybe in the overlay scene, it would be best to create a new display group. I think that would work. Will try.

RESULT…

That doesn’t work. I think the overlay scene is its own group and by adding the graphics in the overlay into a new display.newGroup() its putting it outside of the scene.

Your observation is correct -objects or display groups can always be only in one other group (corona canvas (stage) is also counting as display group for objects inserted nowhere). Storyboard has it’s own group and overlay must also be there. So if you insert overlay inside other group then it’s transfered from storyboard and lost from it’s view

Have you tried :toFront() for your group but after creating scene?

I had a similar issue.  My issue was that I had a scene that had multiple native.textfields, which are always on top of other display objects.  Basically what I did was in the scene:overlayBegan function I moved all the textfields off the screen, then in scene:overlayEnded I moved them back to their original position.  This might be an option for you with the display group.