Copy link to clipboard
Copied
Newly discovered problem with AIR and iOS.... autoOrients is no longer working when launching an iPhone app.
Specifics:
1. Allow auto orientation via app descriptor (I'm doing via Flash Pro CS6).
2. In "main.as", progromatically set autoOrients = "false." (I do this for iPhone, as having orientation set to true in app descriptor allows multiple iPad launch orientation scenarios)
3. PROBLEM: If iPhone is held in landscape mode on launch, app will auto rotate to landscape even with autoOrients set to false. (Portrait should be the default mode for iPhone).
Never had this problem with autoOrients before. Can anyone confirm?
Tried 3.6, 3.7. iOS 5 for iPhone 4S & iOS 6 for iPad.
Copy link to clipboard
Copied
So... basically this gist is: if you have autoOrients allowed, you will not be able to call "stage.autoOrients = false" during initial app startup. It does nothing. I did some testing this weekend, and while changing the call in my code to "this.stage.autoOrients = false" does trace out as "autoOrient = false", the device will still have been allowed to rotate to landscape during launch.
Can't be sure if this is a new bug, or if it was like this all along and I just never tried launching my iPhone app with the device rotated to landscape...
Copy link to clipboard
Copied
The initial or the orientation of the app is decided by the value of aspectratio and autoorients tag in the application descriptor. By the time, actionscript code is hit, the runtime has already figured out the launch orientation and hence you are facing such issue. If you want your app to launch in portrait only mode, set aspectRatio tag to portrait.
Regards,
Nimit
Copy link to clipboard
Copied
If you want your app to launch in portrait only mode, set aspectRatio tag to portrait.
This is a problem if you want to create a universal iOS apps, since many iPhone apps are portrait only, while iPads tend to be held in landscape.
However, my app allows full autoOrients, all aspect ratios, but I wanted the iPhone to be portrait only on launch and then enable rotation later on... Any ideas?
Copy link to clipboard
Copied
You can check for the device type at launch time and set the aspect ratio to portrait if the device is iPhone.
Copy link to clipboard
Copied
Same problem. Device rotates to landscape before any code can "catch" or prevent it...
Again, is suspect this bug made it through because this happens only on the first launch after installation of the device. In subsequent re-launching of the app, all code performs as expected. The behavior is also present on the iOS Simulator.
Just to be clear:
//DOES NOT WORK ON INITIAL LAUNCH OF APP (ON ACTUAL DEVICE)
if (Capabilities.screenResolutionX == 640)
{
//iPhone needs portrait only on launch. iPad needs "any" (set in app descriptor)
stage.setAspectRatio(StageAspectRatio.PORTRAIT);
stage.autoOrients = false;
}
Copy link to clipboard
Copied
Likewise, you cannot set the aspect ratio to portrait in the app descriptor and call set the aspectRatio to ANY for the iPad. Again, the iPad will be forced to launch in portrait mode (lame).
Copy link to clipboard
Copied
Could you please open a new bug report on this over at bugbase.adobe.com? Once the bug has been added would you mind posting back with the URL so that others affected can add their votes and comments?
Thanks for reporting,
Nimit
Copy link to clipboard
Copied
Submitted. Bug #3569075.
Copy link to clipboard
Copied
Additionally, while trying to figure out a work-around for this bug, I determined that stage.orientation always calls "default" on startup for iPhone, while iPad correctly reports "rotated_left" etc.
After much Googling, I found and confirmed that the only reliable way to determine orientation for iPhone on startup is to compart stage.fullScreenWidth against fullScreenHeight. However, this only gives you the aspect ratio, not the specific orientation, BTW.
Copy link to clipboard
Copied
We can only reproduce this for apps that have debugging enabled and hence require to set a connection with a debugger during launch time. For release build the bug is not reproducible. I request you to test it once with release build and check if it is still reproducible at your end.
Regards,
Nimit