Change screen orientation


#1

Hello.
Is anybody know how to change screen orientation in mobile project (like in AS3 - stage.setAspectRatio( StageAspectRatio.LANDSCAPE ); )?
In mobile project i have to start app in portrait mode and after some steps switch to landscape.

Thank you for your help.

p.s. i use:
lime
openfl
msignal
robotlegs
monsterdebugger
actuate


#2

Hi,

you should check Haxe Extensions and at the top you will find extension-orientation i hope this helps you.


#4

Thank you for your answer.

Could you tell me how to apply this extension to my project?
I try to use like it show in extension description, but it don’t work.

Sorry, i’m not to strong to work with extension for HAXE

Thank you.


#5

What error message are you getting? If it’s having trouble with the Java code, you may have to update it to work with Gradle.


#6

I don’t know how to make build of this extension


#7

Did you add <haxelib name="extension-orientation" /> to project.xml?


#8

But before include it into project.xml i have to install it like: haxelib install extension-orientation (installetion don’t work with this line)

or i could simply copy repo into haxelib dir?


#9

I personally use haxelib dev (name of library) (path to library) when using GIT versions of Haxe libraries, such as:

git clone https://github.com/HaxeExtension/(name of extension)
haxelib dev (name of extension) (new folder name)

For some extensions, you may also need to compile native code

lime rebuild (name of extension) android
lime rebuild (name of extension) ios

…but others will only use Java for Android, and do not need to be built


#10

Thank you.
I’ll try this way.

Maybe you could point me to the info about this things? What have to be install on the PC (Andorid SDK, iOS SDK (xcode)) or some thing else.


#11

Could you tell me if this extension implemented for OpenFL3 will it work with OpenFL6?


#12

It looks like the extension is older than when we updated to use Gradle (as Google recommends) rather than ANT, but otherwise, the code seems pretty straightforward – it is all Java, and basically amounts to this call

Extension.mainActivity is a static reference, and a function is being called on it to set the orientation.

Does anyone know if you can do this on iOS?