Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.82k stars 821 forks source link

Feathers PopUpManager covers Starling stats display #1042

Closed subdan closed 5 years ago

subdan commented 5 years ago

Hello, Daniel.

When I add a full screen popup with Feathers PopUpManager.addPopUp() it covers Starling's stats display. Could you fix it?

PrimaryFeather commented 5 years ago

Hm, Josh probably just adds those popups directly to the Starling stage, to make sure it's on top of everything that's part of the "root" object (i.e. the one you're putting your content in).

I'll try to automate this, but here's a quick fix you can paste into your game:

private function moveStatsToTop():void
{
    var stage:Stage = Starling.current.stage;
    for (var i:int=0; i<stage.numChildren; ++i)
    {
        var child:DisplayObject = stage.getChildAt(i);
        if (getQualifiedClassName(child) == "starling.core::StatsDisplay")
        {
            stage.addChild(child); // moves 'child' to top
            break;
        }
    }
}

If you call this method directly after adding a popup, a stats display (if there is one) will be moved back to the top.

Please let me know if that works for you!

subdan commented 5 years ago

Thanks