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: 172
Registered: ‎01-17-2011
My Device: 9500 series
My Carrier: Airtel
Accepted Solution

support orientation

Hi to all...

i am creating an app in playbook , in which i need to support landscape and portrait both view.

i have created my all views in mxml. 

by doing some task i am able to access an event which tells that screen is getting change 

but now i am facing problem to get the width and height of the mxml view.

because if oreintation is 90 degree my code works perfectly. but if u will make it as 180 it will be messed.

please tell me how can i get the display width & height by which i will be able to understand which view should be load.

my code ..  

protected function view1_initializeHandler(event:FlexEvent):void

{

stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE ,onOrientationChange);

protected function onOrientationChange(eventSmiley FrustratedtageOrientationEvent):void

if(landscapeGroup.visible==true

portraitGroup.visible=true

landscapeGroup.visible=false

els

portraitGroup.visible=false

landscapeGroup.visible=true

Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: support orientation

In your function onOrientationChange you could just listen for stage.stageWidth and stage.stageHeight to know the width and height currently. A better solution would be to check the event.afterOrientation value.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Developer
Posts: 172
Registered: ‎01-17-2011
My Device: 9500 series
My Carrier: Airtel

Re: support orientation

Thank uu 

it works