Search code examples
iphoneactionscript-3resolutionstarling-framework

AS3 Starling: How to remove black bars on top and bottom of iPhone 6+/...?


I'm just trying out Starling Framework for Actionscript 3 and I have a "big" problem with removing these ugly black bars on top and bottom of my iPhone 6+.

I tried to fix it with: http://wiki.starling-framework.org/manual/multi-resolution_development and http://forum.starling-framework.org/topic/game-not-full-screen-when-testing-in-ios

But it still wont work :(

Any Ideas?

package {
  import flash.display.Sprite;
  import flash.display.StageAlign;
  import flash.display.StageScaleMode;
  import flash.events.Event;
  import flash.geom.Rectangle;

  import starling.core.Starling;
  import starling.events.ResizeEvent;
  import starling.utils.HAlign;
  import starling.utils.VAlign;

  public class FooBar extends Sprite {

    private
    var _starling: Starling;

    public
    function CHouseApp() {
      super();

      stage.align = StageAlign.TOP_LEFT;
      stage.scaleMode = StageScaleMode.NO_SCALE;

      Starling.handleLostContext = true;

      var screenWidth: int = stage.fullScreenWidth;
      var screenHeight: int = stage.fullScreenHeight;
      var viewPort: Rectangle = new Rectangle(0, 0, screenWidth, screenHeight)


      _starling = new Starling(MainApplication, stage, viewPort);
      _starling.stage.stageWidth = 320;
      _starling.stage.stageHeight = 480;
      _starling.showStats = true;
      _starling.showStatsAt(HAlign.LEFT, VAlign.BOTTOM);
      _starling.start();

    }


  }
}

Screnshot:

(Black bars are marked with red arrow)

Screenshot


Solution

  • You need to include a launch image of name Default-568h@2x.png, of size 640x1136, Default-667h@2x of size 750x1334, Default-736h@3x of size 1242x2208 or iOS will launch the app with a resolution of 640x960, giving you the black bars. You can read the official documentation here