[SOLVED] How do change screen orientation in windows 10 uwp?

Get help using Construct 2

Post » Fri Mar 25, 2016 8:51 am

Hi all!

I can't change screen orientation from portrait to landscape and backward in my windows 10 mobile app, when i touch button and go to layout. Browser object not work.
How i can can do this?
B
11
S
3
Posts: 111
Reputation: 1,401

Post » Fri Mar 25, 2016 7:34 pm

I solved this problem! If you want that your windows 10 universal app toggle from portrait to landscape orientation:

- In construct 2 for lock app in portrait orientation:
On start of layout -> Execute javascript: "Windows.Graphics.Display.DisplayInformation.autoRotationPreferences = Windows.Graphics.Display.DisplayOrientations.portrait;"

- For toggle to landscape orientation:
On start of layout or On touched object -> Execute javascript: "Windows.Graphics.Display.DisplayInformation.autoRotationPreferences = Windows.Graphics.Display.DisplayOrientations.landscape;"

- In visual studio 2015 open package.appxmanifest your app and set in Aplications tab supported rotations - landscape and portraite.
B
11
S
3
Posts: 111
Reputation: 1,401

Post » Wed May 11, 2016 12:36 pm

Hi. Thanks for the update. But how did you try it before when it did not work?

I just made a test project and used this:
Image

It works fine on preview and on mobile browser but I could not test it in Visual Studio yet cause I have no WinPhone to test it or WinTablet. So my example will not work?
B
53
S
16
G
6
Posts: 718
Reputation: 9,150


Return to How do I....?

Who is online

Users browsing this forum: justifun and 5 guests