Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Adobe AIR Development

Reply
Developer
RapsFan
Posts: 423
Registered: ‎08-02-2010
My Carrier: Telus
Accepted Solution

Switching from landscape to portrait mode, what do I do next?

Hello everyone. I setup the accelerometer in my app, setup the listeners, created a 'portrait' state. what's the call to change state in my _accelerometer.onUpdate()?

Please use plain text.
Developer
peter9477
Posts: 5,631
Registered: ‎12-08-2010
My Carrier: none

Re: Switching from landscape to portrait mode, what do I do next?

If you're just trying to have your app support the landscape and portrait orientations, I wouldn't bother using the accelerometer. 

 

Either listen for the StageOrientationEvent.ORIENTATION_CHANGE event, or as I am in my current app just monitor Event.RESIZE and don't worry about "landscape" versus "portrait" but instead just respond to the actual width and height values.

 

I know the Tablet OS developer guide stuff shows an example using the accelerometer, but I have to say it mystifies me why they'd bother suggesting that approach.


Peter Hansen -- (PlayBook and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
RapsFan
Posts: 423
Registered: ‎08-02-2010
My Carrier: Telus

Re: Switching from landscape to portrait mode, what do I do next?

I didn't even read about the accelerometer approach, I just assumed, but you know what they say about people that assume :smileywink: Your approach sounds much better. I created 2 states,  onefor landscape one for portrait already, so in the StageOrientationEvent function can I switch states? If so, how?

Please use plain text.
Developer
RapsFan
Posts: 423
Registered: ‎08-02-2010
My Carrier: Telus

Re: Switching from landscape to portrait mode, what do I do next?

Got it.

 

 

Please use plain text.