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.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 167
Registered: ‎12-17-2010
My Device: Bold 9000
My Carrier: Vodafone
Accepted Solution

Setting PB orientation

Hi, I have browsed the forum but didn't find the total answer to how you can set the PB orientation (landscape/portrait) and preventing it (temporarily) from changing using code.

I want to achieve the following: when the help of my app is launched by the user, I want to set the PB to landscape (if it is in portrait mode) and prevent changing the orientation to portrait as long as the help screen is shown. When the user closes the help (by a label button) rotation should be supported again.

 

I tried the following code when the help is requested by the user (I display a landscape sized image showing the help):

 

private function onHelpClicked (event:Event) : void
{	
	stage.setOrientation(StageOrientation.DEFAULT);
	
	stage.autoOrients = false;

	...
}

And when the user closes help, I set stage.autoOrients back to true.

 

The thing that doesn't work is the setOrientation. At least in the simulator when the PB is in portrait mode and the help is invoked, the orientation doesn't change to landscape.

Any ideas how to solve this?

Eugene

My PlayBook App: Checklists
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Setting PB orientation

Not certain that this is possible, since the fixing of the orientation is done in the config XML files. You might want to submit a feature request for this.
Developer
Posts: 167
Registered: ‎12-17-2010
My Device: Bold 9000
My Carrier: Vodafone

Re: Setting PB orientation

Hm, surprising. But thanks for the response!
Eugene

My PlayBook App: Checklists
Highlighted
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Setting PB orientation

I could be wrong. I recall it being asked about before, but cannot be certain that it was possible. I would say allow it to be visible in either orientation and let the user decide which is best to view instead of forcing them to view in one or the other. This is true more when the BB10 is out. Forcing an orientation change within an app, might be poor UX. Probably have both orientations or one orientation, but not a forced orientation based on a state within the app. $0.02.