AS3 Starling:如何删除iPhone 6 + / ...顶部和底部的黑条?

时间:2021-09-01 18:58:04

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+.

我只是尝试使用Starling Framework for Actionscript 3,我在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

我尝试用以下方法修复它:http://wiki.starling-framework.org/manual/multi-resolution_development和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)

(黑条标有红色箭头)

AS3 Starling:如何删除iPhone 6 + / ...顶部和底部的黑条?

2 个解决方案

#1


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

您需要包含一个名为Default-568h@2x.png的启动图像,大小为640x1136,默认值为667h @ 2x,大小为750x1334,默认值为736h @ 3x,大小为1242x2208,或iOS将启动分辨率为640x960的应用程序,给你黑条。您可以在此处阅读官方文档

#2


I got it! I just had to add the following png's to the src folder! so simple :O

我知道了!我只需要将以下png添加到src文件夹中!这么简单:哦

  • Default-375w-667h@2x.png
  • Default-414w-736h@3x.png
  • Default-568h@2x.png
  • Default.png
  • Default@2x.png
  • List item

#1


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

您需要包含一个名为Default-568h@2x.png的启动图像,大小为640x1136,默认值为667h @ 2x,大小为750x1334,默认值为736h @ 3x,大小为1242x2208,或iOS将启动分辨率为640x960的应用程序,给你黑条。您可以在此处阅读官方文档

#2


I got it! I just had to add the following png's to the src folder! so simple :O

我知道了!我只需要将以下png添加到src文件夹中!这么简单:哦

  • Default-375w-667h@2x.png
  • Default-414w-736h@3x.png
  • Default-568h@2x.png
  • Default.png
  • Default@2x.png
  • List item