0

I have an app using Starling and a native extension for iAds (Milkman Games iAds Extension)

I noticed that when a user clicks the iad, interacts with it and then returns to the game there is a long delay with a black screen as Starling recovers a Stage3D context.

I would like to be able to show some sort of loading screen during this time, but everything I try doesn't seem to work. Does anyone have a suggestion how to implement this? Is it even possible?

Plastic Sturgeon
  • 12,527
  • 4
  • 33
  • 47

1 Answers1

0

This is just a theory, haven't tested it but it should work.

Listen for Event.ACTIVATE. This should trigger when the iAd is closed. It's also triggered a lot of other times so we need to make sure that we check for this black screen, to do this we can simply have this inside the event handler:

private function _onActivateHandler(e:Event):void
{
    if (starling.context.driverInfo.indexOf("Disposed") != -1)
    {
        this.addChild(loadingTextOrBitmapEtcEtc);

        starling.stage3D.addEventListener(Event.CONTEXT3D_CREATE, this._onContext3DCreateHandler);
    }
}

private function _onContext3DCreateHandler(e:Event):void
{
    starling.stage3D.removeEventListener(Event.CONTEXT3D_CREATE, this._onContext3DCreateHandler);

    this.removeChild(loadingTextOrBitmapEtcEtc);
}
xLite
  • 1,441
  • 3
  • 15
  • 28