Prevent orientation change manually

I’m pretty new to Corona and am currently trying to port an app that was partially developed in AS3. The default orientation of the app is portrait but I want it to have landscape orientation as well ONLY if there is a landscape version (file name with Landscape prefix) of that page (module). I have all of the loading and checking working fine however I would like to stop the orientation behavior if there is no landscape view for the currently loaded module.

In AS3 I would use event.preventDefault(); to kill the orientation change and I’m wondering if there is a Corona (or LUA) comparable method. return true seems to kill the rest of the methods functionality however it still rotates the canvas.

Thanks in advance! [import]uid: 89076 topic_id: 23130 reply_id: 323130[/import]

It depends a little on your setup, if you are set to support all orientations by default in build.settings, etc.

I believe we have a native orientation demo in samplecode that shows how you can manually handle orientation changes; this may be what you’re looking for. (Using a flag to prevent/allow rotation, etc.)

Peach :slight_smile: [import]uid: 52491 topic_id: 23130 reply_id: 92529[/import]

Are you referring to the Fishies sample app? Or is there another one also?

Thanks buddy! [import]uid: 89076 topic_id: 23130 reply_id: 92627[/import]

Yes, it uses the fishies sample code although obviously there is additional stuff in there for orientation, etc, in this case.

:slight_smile: [import]uid: 52491 topic_id: 23130 reply_id: 92696[/import]