03-28-2011 03:40 AM
Hi, I have seen lots of people talking about app orientation, and how to get it to work. I've tried many ways last night, but couldn't get anything to work properly.
I've locked my apps to always be landscape for the meantime, and this seems to work well, but I'd like to have them working both ways, but can't get it to scale properly, as when I change orientation to portrait, my app simply crops in half.
I'm wondering if anyone has any definitive way of doing it, and if anyone could give me some tips on how to accomplish it.
With kindest regards,
03-28-2011 10:34 AM
For the apps I've done, I completely reposition all of the elements on the screen so that it looks nice in that orientation. I was never happy with the scaling when I saw it.
Generally, I create all of the elements in a constructor nd then call a Layout method which positions them based on the current orientation.
03-28-2011 11:43 AM
Is it really the only way though? No other way of doing it automatically (programmatically)?
03-28-2011 12:17 PM
There is seldom only one way to do something. You can use the autoscaling, but like I said, I wasn't happy with it when I saw it. I think your original post was asking how to scale it properly, and I can't really answer that since I didn't actually do it that way. I THINK its just a matter to setting the auto scale to true in your XML file, but it sound slike you've tried that and aren't happy with it.
03-28-2011 02:17 PM
My app is 600 x 600 so it can sit comfortably in the middle of the screen in either orientation. I set scaling to NO_SCALE and alignment to TOP_LEFT. then use an event listener for the screen resize event to position the app in the middle of the stage. The one I am working on now will do the same thing. The one after that will require two different screen layouts depending on the orientation, and so I'll have a routine to re-position the necessary elements on the change. Depends a lot on what you are trying to do.