简体   繁体   English

如何设置Starling以使用全屏iphone4和iphone5

[英]How to setup Starling to use full screen iphone4 and iphone5

I am considering updating my app to take advantage of iphone5's bigger screen but not sure how to achieve this is as3. 我正在考虑更新我的应用程序,以利用iphone5的更大屏幕,但不确定如何实现as3。

I have tried a few suggestions online however unable to get them working. 我已经在网上尝试了一些建议,但无法使其正常工作。 The app works and looks fine with no modification but just letterboxes top and bottom. 该应用程序可以正常运行,并且看起来没有任何修改,只是信箱顶部和底部。

This is my code: 这是我的代码:

var stageWidth:int   = Constants.STAGEWIDTH; // Hardcoded to 320
var stageHeight:int  = Constants.STAGEHEIGHT; // Hardcoded to 480
var screenWidth:int  = stage.fullScreenWidth;
var screenHeight:int = stage.fullScreenHeight;

Constants.FULLSCREENWIDTH = stage.fullScreenWidth;
Constants.FULLSCREENHEIGHT = stage.fullScreenHeight;

var iOS:Boolean = Capabilities.manufacturer.indexOf("iOS") != -1;
Starling.multitouchEnabled = false;
Starling.handleLostContext = true; 

var viewPort:Rectangle =  new Rectangle(0, 0, stage.fullScreenWidth, stage.fullScreenHeight);
var startupImage:Sprite = createStartupImage(viewPort, screenWidth > 320);

Many thanks! 非常感谢!

Add a launch image named Default-568h@2x.png to the package. 将名为Default-568h@2x.png的启动映像添加到程序包。 The resolution of this launch image should be 1136*640 pixels. 此启动图像的分辨率应为1136 * 640像素。 In case you are already using a namespace schema for your launch images, you can just append ”-568h@2x” to the namespace schema. 如果您已经在启动映像中使用了名称空间架构,则只需将“ -568h @ 2x”附加到名称空间架构即可。

taken from http://blogs.adobe.com/airodynamics/2012/11/07/deploying-air-apps-on-iphone-5/ 取自http://blogs.adobe.com/airodynamics/2012/11/07/deploying-air-apps-on-iphone-5/

also, stageWidth on starling will be 568 now, not 480 like in 3.5" screens 此外,八哥的stageWidth现在将为568,而不是像3.5英寸屏幕那样为480

try to hardcode this now. 现在尝试对此进行硬编码。

var screenWidth:int  = 640;
var screenHeight:int = 1136;
var viewPort:Rectangle = new Rectangle(0, 0, screenWidth, screenHeight)

starling = new Starling(Game, stage, viewPort);
starling.stage.stageWidth  = 320;
starling.stage.stageHeight = 568;

If this works, it means that you get wrong stageWith and stageHeight from stage.stageWidth. 如果这样做有效,则意味着您从stage.stageWidth获得了错误的stageWith和stageHeight。

here you can see how to correctly get stageView and stageHeight but that is different topic 在这里您可以看到如何正确获取stageView和stageHeight,但这是不同的主题

http://forums.adobe.com/message/3712344 http://forums.adobe.com/message/3712344

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM