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
eugenevk
Posts: 167
Registered: ‎12-17-2010
My Device: Bold 9000

PlayBook orientation change

I have built in the example for orientation handling from the manual. What the example doesn't show is what to do with the subcontainers after an orientation change.

I have two subcontainers that I have added to a main container with flow set to

flow = ContainerFlow.HORIZONTAL;

 After this setting I use addChild to add the subcontainers:

addChild(_conCategories);
addChild(_conListsPanel);

 These two containers have the following size: 25 resp. 75 with both

sizeUnit = SizeUnit.PERCENT;

On initial launch in landscape the screen looks fine: _conCategories is shown left of _conListsPanel with ratio 25:75.

After an orientation change to portrait I want to have _conCategories to be on top of _conListsPanel. My question is how to achieve that. In the example reorientation function it only says:

_conMain.setSize(stage.stageWidth, stage.stageHeight);

 but this doesn't change the position of my containers.

Eugene

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

Re: PlayBook orientation change

Those containers do not change their flow automatically. Have you tried resetting the flow direction on orientation change?

Sometime it is easier to position and size objects in the draw() function and check if the width > height to determine the current orientation.
Please use plain text.
Developer
eugenevk
Posts: 167
Registered: ‎12-17-2010
My Device: Bold 9000

Re: PlayBook orientation change

I thought the use of containers was the prescribed way for automatic reorientation. Hmm. And yes, I did try changing the flow direction, but no luck.
Eugene

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

Re: PlayBook orientation change

It probably is, but the early versions were so buggy that I just stayed away from them. If you get it to work, great. Personally, I never had much success with how the QNX containers and library items were designed. Little counter intuitive.
Please use plain text.
Developer
pyth
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane

Re: PlayBook orientation change

I also had lots of problems as well (still do at times). What I did was extending Container, calling it BasePane and using that for everything. My BasePane class has this method

 

		/**
		 * To be overwritten by all pane containers. asserts correct orientation
		 **/
		public virtual function updateOrientation(e:StageOrientationEvent):void
		{
			for (var i:int = 0; i < numChildren; i++) 
			{
				if (getChildAt(i) is BasePane)
				{
					(getChildAt(i) as BasePane).updateOrientation(e);
				}
			}	
		}

 which is called down to the lowest member. The main container is the only one listening to the stageOrientationEvent

 

After that, the position is set by hand inside updateOrientation if needed

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Please use plain text.