Skip to main content
Known Participant
January 11, 2017
Question

iPhone Plus sizes returning wrong dimensions?

  • January 11, 2017
  • 2 replies
  • 555 views

My application has the set stage size of 640x960. I have it scaled with SHOW_ALL

var screenH:Number =  Capabilities.screenResolutionY;

var screenW:Number =  Capabilities.screenResolutionX;

scaledH = screenH / 960; //2 for iPhone 6+

scaledW = screenW / 640; //1.6875

  if (scaledW < scaledH) {

       screenRatio = scaledW;

  } else {

       screenRatio = scaledH;

  }

  screenHextra = (screenH - (960 * screenRatio)) / 2;

  screenWextra = (screenW - (640 * screenRatio)) / 2;

After the scaling is done using SHOW_ALL, screenHextra should technically give me the extra stage space on the top and bottom. This works on iPhone 5's and somewhat on iPhone 6's but the numbers being returned on the iPhone plus sizes are way off. Is it something i'm missing?

I have tested the values returned on the iPhone 6, my graphics which are positioned based on the screenHextra are not exactly where they should be, but usable. But like I said the plus sizes are way off.

This topic has been closed for replies.

2 replies

Known Participant
January 11, 2017

Colin Holgate

Sorry it is a iPhone.png i just typed it incorrectly on here.

My stage is set to 640x960 but my background asset is 892x1160. So no matter what the stage is scaled to, there is always something on screen for the iPads with the focus being in the 640x960. However for some assets , like my navigation button, I am trying to move towards the bottom of the screen.

It seems like your calculation works, I just have to make sure the extra height is not changed if it's less than 0 after the calculation. (for iPads)

screenHextra = ((screenH / screenW) * 640) - 960; //top and bottom extra

  if (screenHextra < 0)

  {

       screenHextra = 0;

  } else {

       screenHextra = screenHextra /  2;

  }

Thanks for the help Colin

Colin Holgate
Inspiring
January 11, 2017

Something to watch out for if you do an Android version: devices like Amazon Fire HD have a full screen mode, and a status bar that comes and goes, which can lead to confusion when it comes to AIR reading the available screen area. I think that got improved over time, so using a later version of AIR might help. The solution I used previously was to have my buttons that hug the top of the screen be taller than really needed, with the icon or word in the lower part. It doesn't look too strange on non-Amazon devices, and on the problematic devices it just cuts off some of the top of the button.

Known Participant
January 11, 2017

Alright thanks for the heads up. All my navigation is towards the bottom of the screen, are there any issues with the lower part?

Inspiring
January 11, 2017

So yes u are saying that when you read Capabilies.screenresolution, they are giving you incorrect values on iphone 6+ ?

If so, make sure you package the appropriate sized and named splash screen for that device. That is what dictates the screen resolution.

Launch Images on iOS with Adobe AIR

Known Participant
January 11, 2017

My splashscreen files are as follows:

Default@2x~iphone.png

Default~iphone.png

Default-375w-667h@2x~iphone.png

Default-414w-736h@3x~iphone.png

Default-568h@2x~ipad.png

Default-Portrait@2x~ipad.png

Default-Portrait~ipad.png

Is there anythign wrong or missing with those? Any help would be appreciated. Thanks

Known Participant
January 11, 2017

I suppose it needs the landscape launch image aswell?

I don't think that solves the incorrect placement on the iPhone 6 tho