Adobe-Runtime-Support
Adobe-Runtime-Support copied to clipboard
[AIR 33.1.1.926][Android] Stage::setAspectRatio() incorrect work
Problem Description
Stage::setAspectRatio()
incorrect work for Android devices with AIR 33.1.1.926.
This break many applications that used it.
I found two problems around it.
Tested with AIR 33.1.1.926 with different AIR applications, Android devices and architectures. Same problem in all cases. It works fine with AIR 33.1.1.889 and earlier. There is no such issues with iOS.
Related issue: https://github.com/airsdk/Adobe-Runtime-Support/issues/2042
Steps to Reproduce
Note: application manifest have <autoOrients>true</autoOrients>
and didn't have aspectRatio
at all.
- Launch code below with any Android device that allows you to rotate it (better to use phone/tablet). It just show red rectangle in landscape orientation (caused by
stage.setAspectRatio(StageAspectRatio.LANDSCAPE)
). - Try to rotate your device upside-down (in landscape upside-down orientation). Application will not rotate (but it should) - bug 1.
- Click anywhere on stage (to call
stage.setAspectRatio(StageAspectRatio.ANY)
and "unlock" rotation to any orientation). - Rotate device in any other orientation.
Application example with sources attached. set_aspect_ratio_bug.zip
package {
import flash.display.Sprite;
import flash.display.StageAspectRatio;
import flash.events.MouseEvent;
public class SetAspectRatioBug extends Sprite {
public function SetAspectRatioBug() {
//Draw rectangle just to better demonstrate "rotaton" problem
graphics.beginFill(0xff0000);
graphics.drawRect(0, 0, 300, 50);
graphics.endFill();
stage.addEventListener(MouseEvent.CLICK, click);
stage.setAspectRatio(StageAspectRatio.LANDSCAPE);
}
private function click(e:MouseEvent):void {
stage.setAspectRatio(StageAspectRatio.ANY);
//stage.autoOrients = true;//Uncomment with line to workaround
}
}
}
Actual Result: Application will not rotate - bug 2.
Expected Result: Application will rotate as with AIR 33.1.1.889.
Known Workarounds
For bug 1 - none. May be write own native extension to control application orientation.
For bug 2 - use stage.autoOrients = true
after stage.setAspectRatio(StageAspectRatio.ANY)
. You can see this commented line in code above.
FYI we have a fix for this one now in the updated release: https://airsdk.harman.com/download
Fixed with latest AIR 33.1.1.929. Thanks!