• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

A cleaner StageOrientation?

Explorer ,
Jun 15, 2011 Jun 15, 2011

Copy link to clipboard

Copied

Hi,

Is there a way to skip the "smooth" rotating transition when changing orientation on the device?

It currently looks quite bad as the game is very jerky during this transition (I'm using an iPad 1). There is also a new bug in Air 2.7 with fullscreen Landscape mode, and when I use a workaround (setting it to portrait and using setOrientation to make it landscape) I still see a small list doing the rotating transition even though the rest of the screen is blank. Very frustrating.

I would like to see an option for an instant, clean change between orientations, to avoid these issues.

Thanks.

/Andreas

TOPICS
Development

Views

2.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 15, 2011 Jun 15, 2011

Copy link to clipboard

Copied

You can turn off auto orient, and look at the accelerometer to know which orientation to use, and then set the orientation yourself. I think that then works instantly, and it makes it easy to disable orientations you don't want.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 15, 2011 Jun 15, 2011

Copy link to clipboard

Copied

Hey Colin,

have you tested this?


I still don't know any good way to do so, but haven't tested that (I think I tried anything else)...

Regards,

Josh

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 15, 2011 Jun 15, 2011

Copy link to clipboard

Copied

I haven't needed to, but I know of people who have used that method to solve the issue on Android, which doesn't have a changing event. Doing your own thing solves a few different issues.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 15, 2011 Jun 15, 2011

Copy link to clipboard

Copied

Thanks looks like a good start.

Something different, but same... Do you remember the topic where someone was looking for a solution how to change the initial default image rotation (right now it doesn't matter which site you start, in landscape mode on iPhone the app always starts one way)?

Was it just another default image with the right name?

Regards,

Josh

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 15, 2011 Jun 15, 2011

Copy link to clipboard

Copied

Thanks for the suggestion Colin, but unfortunately the transition is still there when you set the orientation manually.

/Andreas

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 15, 2011 Jun 15, 2011

Copy link to clipboard

Copied

Andreas, did you try the accelerometer idea? From my point of view this could be the only way to solve it. I tried like five other methods and they all where weird and looked by far not like a native app.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 15, 2011 Jun 15, 2011

Copy link to clipboard

Copied

Unfortunately Andreas is right. Here's an idea for a work around:

When you see that the user is trying to rotate the device, hide everything.

Add a listener for orientationChange, which gets sent when the orientation has finished changing.

Show everything.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 15, 2011 Jun 15, 2011

Copy link to clipboard

Copied

Hey Colin,

Stage.Orientation is (in my opinion) too slow. You see the screen moving directly before it starts to react and switches to the right side of the screen (for example just having landscape, then you would see a switch to portrait and then a movement to landscape). If the screensize is fullscreen, then it scales even up to portrait which distracts the feel of an app.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 15, 2011 Jun 15, 2011

Copy link to clipboard

Copied

I'm not sure if the slowness is because Flash is using the iOS transition. If they are there may not be much they can do about the speed. But it's worth sending in a request.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 15, 2011 Jun 15, 2011

Copy link to clipboard

Copied

The orientation experience (in my opinion) is a bit different than other apps so I don't think it is a default iOS transition. There is also some weird scaling and jumping going on that doesn't look right. I have actually spotted a few Flash based apps by the look of this transition.

I have noticed a few new non-Flash iOS apps using a clean instant version that I think is the best experience for users.

I'm trying to post this as a Labs idea, but get "Error: create member -3" right now. Maybe you guys have better luck

/Andreas

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 15, 2011 Jun 15, 2011

Copy link to clipboard

Copied

You could include all your Flash bits in one movieclip, then set its rotation to make it seem like the orientation had changed instantly. Any mouse events would still have a valid local x and y.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 16, 2011 Jun 16, 2011

Copy link to clipboard

Copied

Interesting idea, I will try that

/Andreas

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 16, 2011 Jun 16, 2011

Copy link to clipboard

Copied

I will have a look at this today and try the acceleration idea, which should actually work, but a. orientation change will not behave as intended (the selection in Flash should do that for us) and b. could be such a hard change to an app we are currently doing that this might just be something to have in mind when building a new app.

As Andreas said, a normal app switches in a different manner (and it is just ONE click in xCode). I still don't know why the selection from within Flash doesn't work as intended -> selecting your view (portrait or landscape) and selecting autorotation should exactly do that for us.

Since this is a request by Apple to support all views (if functionwise possible) it would make sense to make this work from within Flash.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jun 16, 2011 Jun 16, 2011

Copy link to clipboard

Copied

Hi,

Could you log a bug for this problem at https://bugbase.adobe.com/index.cfm( Product - Adobe AIR, Version -2.x) and post the bug number here?

Thanks,

Sanika

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 16, 2011 Jun 16, 2011

Copy link to clipboard

Copied

Hi Sanika,

I have added a bug report:

https://bugbase.adobe.com/index.cfm?event=bug&id=2898292

All, please feel free to add a better explanation to this issue.

/Andreas

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 16, 2011 Jun 16, 2011

Copy link to clipboard

Copied

Do you know how to use the accelerometer to set orientation?  I want my application to run in Landscape mode and always displayed upright.  If the user turns the phone to a portriat view I want to ignore it, but like I said if they keeps turning to landscape again it needs to flip the view so it is upright.  Here is what I did and it is not working. First in the MyTest-app.xml file I set. <autoOrients>false</autoOrients> and <aspectRatio>landscape</aspectRatio>

// MyTest.as snippet. I left out the package and imports from this example and removed other stuff not pertinent to the topic.

public class MyTest extends Sprite {

     private var _accelerometer:Accelerometer;

     private var _field1:TextField = new TextField();

     private var _field2:TextField = new TextField();

     private var _lastPosition:int;

     public function MyTest() {

          stage.align = StageAlign.TOP_LEFT;

          stage.scaleMode = StageScaleMode.NO_SCALE;

          stage.displayState = StageDisplayState.NORMAL;

          Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

          _lastPosition = 1;

          // Fields for Debugging

          _field1.y = 10;

          _field1.width = 200;

          addChild(_field1);

          _field2.width = 200;

          _field2.y = 20;

          addChild(_field2);

          stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, onOrientationChange);

          if (Accelerometer.isSupported) {

               _accelerometer = new Accelerometer();

               _accelerometer.setRequestedUpdateInterval(1000); // Check once a second

               _accelerometer.addEventListener(AccelerometerEvent.UPDATE, _accelerometer_Update);

          }

     }

     protected function _accelerometer_Update(event:AccelerometerEvent):void {

          var y:int = Math.round(event.accelerationY);

          _field1.text = "Position " + y;

          if (y != _lastPosition && y != 0){

               var before:String = (_lastPosition == 1) ? StageOrientation.ROTATED_LEFT : StageOrientation.ROTATED_RIGHT;

               var after:String = (y == 1) ? StageOrientation.ROTATED_LEFT : StageOrientation.ROTATED_RIGHT;

               _lastPosition = y;

               dispatchEvent(new StageOrientationEvent(StageOrientationEvent.ORIENTATION_CHANGE, true, false, before, after));

          }

     }

     protected function onOrientationChange(event:StageOrientationEvent):void

     {

          _field2.text = event.beforeOrientation + " " + event.afterOrientation;

          stage.setOrientation(event.afterOrientation);

     }    

}

When I run this code the _field1 shows the proper value from the accelerometer depending on how I have the phone oriented. The _field2 even shows the correct events being handled, but the display doesn't flip upright. I look at it upside down when I flip the phone.  I also wasn't sure if I should use StageOrientation.DEFAULT and UPSIDE_DOWN, but when I did that I somehow got the phone in portrait mode... and then could not get it to move.

I am using a Motorola Droid with Air 2.7.0.1948 and Android version 2.2.2 and used Flash Builder 4.5 to create everything.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 16, 2011 Jun 16, 2011

Copy link to clipboard

Copied

A few people have written articles about this, but I can't find one in English right now. Do a Google search on this:

if (Math.abs(evt.accelerationX) > Math.abs(evt.accelerationY))

and that will show several pages. Translate one of those, but first look at the code in the non translated version. Unless you speak German or Japanese, in which case read the original!

The technique is simpler than yours, you first deduce if you are in landscape or portrait, and then whether you are left, right, default, or upside down.

The event returns a Number by the way, so even your routine might have a chance if you didn't convert that to an int.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 21, 2011 Jun 21, 2011

Copy link to clipboard

Copied

LATEST

Hi all,

Colin has linked to a couple of movies on the http://www.bytearray.org/ site and at least the Cache and Rossignol apps both do have a great orientation change (and are, of course Flash or Flex made).

Too sad that I don't know how they archived it, but it is great to see that there is a solution available. Maybe someone knows someone who know one of the developer and could find out how they made it?

Regards,

Josh

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines