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
Ebscer
Posts: 855
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon
Accepted Solution

Force Landscape Mode

In the Q and A section of the last webcast it was mentioned that it was possible to force an application into landscape or portrait orientation. However, I missed the details on how, and was hoping that someone had the details for doing this...


Read my thoughts on BlackBerry Development at news.ebscer.com
Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Force Landscape Mode

hey ebscer,

 

to lock in the orientation you have to edit/add details to your -app.xml descriptor file. open the file and locate the <initialWindow> </initialWindow> tags. Add the following lines somewhere between the two tags (mine are right before the close tag):

 

 

<autoOrients>false</autoOrients>
<aspectRatio>landscape</aspectRatio>

 

that should do the job! good luck!

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Please use plain text.
New Developer
cookeit
Posts: 27
Registered: ‎12-11-2010
My Device: Not Specified

Re: Force Landscape Mode

Given that the simulator doesn't support rotation yet and most people here don't have an actual device how are you handling rotation in your apps? Are you simply locking to a certain rotation?

 

My app was going to use a three pane layout which could easily support portrait but without a way to test it out is it worth trying?

Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Force Landscape Mode

hey cookeit,

 

the way i go about it is lock in the orientation and dont worry about if the user does decide to put the tablet in portrait mode, for now. at least until the actual device is released or the simulator supports the rotation. in my opinion if you cant test it and you arent 100% sure that your orientation code is working i dont think its worth it to try and do a dynamic repositioning type code. but on a brighter note according to the last webcast they will try to get developers the playbook before consumers get them so we can optimize our coding and possibly be able to do a lot more testing such as the rotation.

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Please use plain text.
New Developer
cookeit
Posts: 27
Registered: ‎12-11-2010
My Device: Not Specified

Re: Force Landscape Mode

Thanks for your response.

 

I'm just getting into Playbook development having done mostly Java + PHP previously so I was just wondering if I had missed something as I've only had to deal with smartphones that don't support rotation until now.

 

I'll make sure my code has rotation in mind but lock to landscape for now.

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Force Landscape Mode

It was also suggested to just change the size of the width and height of the root Sprite to arrange the GUI.  In your layout function, you can simply check if stage.stageWidth > stage.stageHeight for landscape, else portrait.  Then it would be to simply listen for the rotation and re-call that function.  so you can get everything in place and then once you receive the PB, it would be a sinple uncommenting to the listener and some tweeks.

Please use plain text.
Developer
Ebscer
Posts: 855
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon

Re: Force Landscape Mode

I too am plaining on locking to landscape orientation for version 1.  Once I can test on a real device, then I will feel better about having a bit less control over the layout...


Read my thoughts on BlackBerry Development at news.ebscer.com
Please use plain text.
New Developer
jjackson
Posts: 18
Registered: ‎11-14-2010
My Device: Not Specified

Re: Force Landscape Mode

<autoOrients>false</autoOrients>
<aspectRatio>landscape</aspectRatio>

This code doesn't make it into the bar file when you unzip it. The compiler leaves it out.

Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Force Landscape Mode

hey,

 

just checked my descriptor file by unzipping the bar file and the autoOrient tag is still there. how are you package the program?

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Please use plain text.
New Developer
Cubed
Posts: 15
Registered: ‎10-30-2010
My Device: Not Specified

Re: Force Landscape Mode

[ Edited ]
 
Please use plain text.