Skip to main content
Known Participant
October 31, 2011
Question

universal landscape only on Android, shadows bug

  • October 31, 2011
  • 1 reply
  • 800 views

Hi,

I am trying to write universal landscape only code (so the stage re-orients only when in rotatedLeft or rotatedRight orientaion) for Android.

Testing on Archos 70 internet tabled forced me to use Timer that checks deviceOrientation instead of adding stage listeners (no stage changing events are dispatched) and to rotate MainTimeline (stage.setOrientation does nothing).

This works on Archos 70 (with Android 2.2.1) but other testers reported there are issues on Android 3.0 devices.

The half-solution could be to disable autoOrients but there is a problem that initial rotation (after application launch) is not correct - it is always in the basic rotatedLeft orientation.

I do not own any Android 3.0 device so I can't test it effectively and would really appreciate any advice (or code samples).

Thank you!

(I have also found the bug when rotating MainTimeline - shadows don't change their direction)

This topic has been closed for replies.

1 reply

Colin Holgate
Inspiring
October 31, 2011

If you could require Android 2.3, then you would get a changing event you can use.

Some Android tablets consider landscape to be Default, and portrait would be rotatedleft or rotatedright. Testing to see if the stage width is greater than the stage height, after a resize event, should be consistent.

jendabekAuthor
Known Participant
October 31, 2011

Thanks Colin,

I think it is a bit more complicated - I want to ensure it will work on all Android devices / OS version.

So for lower than 2.3 I have to use the Timer and rotate MainTimeline, is it correct? But still there is the problem when deviceOrientation values are swapped (as you noted).

OK, on Android >= 2.3 I can work with RESIZE event, but doesn't RESIZE event fires after orientation change? So how can I prevent changing orientation to portrait?

Thank you!

Colin Holgate
Inspiring
October 31, 2011

Any version can use the resize event. Old Android can use the changed event, but only 2.3 and later can use the changing event.

changed happens after it has rotated, changing happens before it rotates, and with older AIR, or with new AIR and Android 2.2, you don't get the changing event at all.

Incidentally, as AIR requires at least 2.2, you wouldn't be giving up that many users by requiring 2.3.