Skip to main content
avtutorials
Known Participant
June 24, 2013
Question

AIR 3.7 stage.orientation Not Working Properly

  • June 24, 2013
  • 2 replies
  • 2259 views

This was originally posted in the Flash Pro CC forum, and it was recommended that I post it here, instead.

Using: Flash CS6 12.0.2.529 and AIR 3.7.0.1860 SDK

Background: I first built an app using Flash CS6 and AIR 3.4, including the requiredDefault-568h@2x.png image, and it worked on all iPhones and all iPads.  I submitted it to Apple.  They rejected it, stating that that Default image was NOT present (in fact, it was).  The solution (from another forum) was to compile to AIR 3.7 SDK, so I did.  Apple's system then accepted the app.  But now, Apple stated that there were orientation and display problems: my app was crashing for them and not filling the entire screen.  This new problem occurred only with my AIR 3.7-compiled app.

Problem 1 (kinda' resolved): After a ton of troubleshooting, I realized that stage.orientation (in my first frame) was always resulting in null.  This was causing my app to crash upon launch.  I moved stage.orientation to frame #2, and it worked.  Therefore, for some reason, with AIR 3.7, stage.orientation CANNOT be in the first frame (again, this worked with AIR 3.4 and became "broken" with AIR 3.7).

Problem 2 (not resolved): When running an app in the background, stage.orientation does not process.  Example: I use a stageWebView window to display an MP4 video.  When the user 1) stretch-swipes the video to make it full-screen, 2) then changes the device orientation, and 3) shrinks the full-screen video back down again, the app remains in the previous orientation (not the new orientation).  Stated differently: 1) view the app in landscape, 2) swipe the video to full screen, 3) change device orientation to portrait, 4) close/shrink the video, and 5) the app appears again but in landscape (not portrait, as it should).  It appears that stage.orientation, thus, does not process when the app is in the background -- but, it should!  Again, this worked properly with AIR 3.4 and became "broken" with AIR 3.7.

Can anyone please provide some guidance on how/if I can make this work?  I'm just frustrated that this worked with AIR 3.4 and not with AIR 3.7.  Thank you for your help.

This topic has been closed for replies.

2 replies

Participant
September 13, 2013

This is from the bug:

http://watsonexp.corp.adobe.com/#bug=3556923

The iOS 6 upgrade let to this bug injection. We use didRotateFromInterfaceOrientation callback to fire orientation change event. iOS 6 release notes clearly mention that "The willRotateToInterfaceOrientation:duration:,   willAnimateRotationToInterfaceOrientation:duration:, and didRotateFromInterfaceOrientation: methods are no longer called on any view controller that makes a full-screen presentation over itself. When a rotation occurs for a visible view controller, the willRotateToInterfaceOrientation:duration:, willAnimateRotationToInterfaceOrientation:duration:, and didRotateFromInterfaceOrientation: methods are called during the rotation. The viewWillLayoutSubviews method is also called after the view is resized and positioned by its parent. If a view controller is not visible when an orientation change occurs, then the rotation methods are never called. However, the viewWillLayoutSubviews method is called when the view becomes visible. Your implementation of this method can call the statusBarOrientation method to determine the device orientation". As a result orientation change events are not fired. viewWillLayoutSubviews is called but only when the view becomes visible again. The user bug in interested in getting all orientation events during a full screen video playback which we cannot provide because of the changes made by Apple in iOS 6. We might be able to provide the orientation change event when the view becomes visible again but it will still confuse the developers.  Since we cannot forward all orientation change events during full screen video playback, its best to provide none!

Please note that only this event is not fired in this bug. Automatic stage re-sizing does take automatically as it should.

Some relevant links

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/didRotateFromInterfaceOrientation:

https://developer.apple.com/library/ios/releasenotes/General/RN-iOSSDK-6_0/

https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/RespondingtoDeviceOrientationChanges/RespondingtoDeviceOrientationChanges.html

Marking this as ToTest/AsDesigned since it is because of design limitation put by Apple in iOS 6.

Participant
June 29, 2013

Just bumping this thread, in case someone from Adobe can kindly reply.  Thank you.

Inspiring
June 30, 2013

Sounds similar to bugs I've reported: 3486264, 3556923, 3569075.

You may find some hints at how to solve your particular problem in my bug notes. Seems AIR just isn't built to handle native iOS fullscreen video and orientation/screen changes... You will likely need to implement your own workaround.

Personally, I'm done with spending untold hours to code around AIR's iOS limitations and bugs have decided to just port my project to Xcode/objective C.

Anway, hope you find a solution to your issue. (And that if you do, it survives transition to iOS 7 in the fall!)

avtutorials
Known Participant
July 1, 2013

gtr, thanks very much.  I viewed your bug reports, and it looks like much of the same problem.  I see that you began reporting this in January 2013 and made other reports as recent as June 2013.

It really looks like Adobe needs to address this, especially since you stated that this is present in the AIR 3.8 SDK Beta.  Again, this wasn't a problem in AIR 3.4 SDK.

If anyone from Adobe is reading, would you kindly reply and give a status update on the bugs that gtr reported?  Thank you.