• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

AIR16 iOS Aspect Ratio Bug

Engaged ,
Jan 20, 2015 Jan 20, 2015

Copy link to clipboard

Copied

I've recently begun to update an AIR app for both iOS and Android that was originally published with AIR 4 to use the latest AIR SDK 16.

By default the app is set to allow both Landscape and Portrait by setting the app.xml to  <aspectRatio>any</aspectRatio> and all the UI resizes to fit the width/height.

Then, through code I do a little math to determine if it's a large or small device, and if small, I set the aspect ratio to be Landscape as soon as the app begins.

var resolutionX:Number = Capabilities.screenResolutionX;

var resolutionY:Number = Capabilities.screenResolutionY;   

var numDiagonalInches:Number = Math.round(Math.sqrt((resolutionX*resolutionX)+(resolutionY*resolutionY)))/Capabilities.screenDPI;

MainData.SMALL_DEVICE = (numDiagonalInches<6)?true:false;

if(MainData.SMALL_DEVICE){

    this.stage.setAspectRatio(StageAspectRatio.LANDSCAPE);

}

This code worked correctly with the version of AIR it was published, but trying on the latest AIR 16 there is a very weird and easy to reproduce bug.

The bug ONLY happens when the app is launched in the Portrait Mode. When the app launches in portrait mode with its initial aspect ratio set to any, we detect its small and set the aspect ratio to Landscape. Everything looks fine until you turn the device 180 degrees... Now all of a sudden the app rotates what seems like 270 degress and becomes stuck and will never fix itself, rendering the app completely useless.

Here is a video demonstration of the bug: AIR 16 aspect ratio bug - YouTube

TOPICS
Development

Views

670

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Jan 20, 2015 Jan 20, 2015

I found an acceptable workaround without having to go do the work manually... Basically just inverting my logic.

Instead of having the app.xml set to "any" and then through code telling small devices to be "landscape"... I told the app.xml to be "landscape" and then through code told Non-small devices to be "any".

The downside is that the app will no longer launch in portrait mode, but after its booted it will then start responding to device rotations.... but hey on an upside i've now got a smalle

...

Votes

Translate

Translate
LEGEND ,
Jan 20, 2015 Jan 20, 2015

Copy link to clipboard

Copied

Quite a while ago things were changed so that an app that was just portrait, or an app that was just landscape, had an easier time than it used to. That was at the expense of apps that needed both. Your best option may be to turn of auto rotation completely, and use your own detection to see what orientation the device is at.

Incidentally, make sure to include a Default-568h@2x.png splash screen.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 20, 2015 Jan 20, 2015

Copy link to clipboard

Copied

So basically you're saying instead of Adobe fixing this bug I should just do without a feature we've had for over 2 years because of the latest AIR sdk? Our app has specific functionality that is enabled only in certain aspect ratios.... it is completely not an option to just "turn off auto rotation completely".

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 20, 2015 Jan 20, 2015

Copy link to clipboard

Copied

Turning off autorotation doesn't mean it can't rotate. It just means that you would look after that instead of AIR doing it. You can set the orientation to match the apparent device orientation, at the same time as changing your interface.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 20, 2015 Jan 20, 2015

Copy link to clipboard

Copied

Ok I guess that makes sense... it just sucks to have to go do extra logic/reinvent the wheel...because of a dumb bug when it's been 100% working in the past.... is there any way you think this would ever just get fixed? Like can I at least ask you acknowledge it's a bug and SHOULD be fixed regardless of whether it does. I took on the task of updating the app to the latest SDK to be ready before February and instead of a couple hour choir I've now gotta go do research because of a dumb bug.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 20, 2015 Jan 20, 2015

Copy link to clipboard

Copied

I found an acceptable workaround without having to go do the work manually... Basically just inverting my logic.

Instead of having the app.xml set to "any" and then through code telling small devices to be "landscape"... I told the app.xml to be "landscape" and then through code told Non-small devices to be "any".

The downside is that the app will no longer launch in portrait mode, but after its booted it will then start responding to device rotations.... but hey on an upside i've now got a smaller filesize to my app without the portrait default images!

But this doesn't mean I don't want the bug fixed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 21, 2015 Jan 21, 2015

Copy link to clipboard

Copied

Is your UI perfectly clickable after orientation? I have found that with latest AIR SDK (16) the UI renders correctly when switching from one orientation to the other but clicks are not fired correctly (the positions seem offset)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 04, 2015 Mar 04, 2015

Copy link to clipboard

Copied

LATEST

Thanks for reporting the issue.

Could you please update to the latest Beta AIR SDK 17 and let us know in case you still face the issue.

Regards,

Adobe AIR Team

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 20, 2015 Jan 20, 2015

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines