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

Air 2.6 Screen orientation

New Here ,
Mar 28, 2011 Mar 28, 2011

Copy link to clipboard

Copied

I'm trying to get this Air 2.6 feature to work again.

http://kb2.adobe.com/cps/891/cpsid_89107.html

Changes in AIR 2.6

Screen orientation changes in 2.6 namespace

Based on the release doc, it says "The swf is required to be compiled with the flag "-target-player=11" to make use of supportedOrientations API."

How do I "compile with the flag" ???

I'm using Flash CS5 to publish .swf

I got the adt cmd line working.

My AS3 script:

addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, onOrientationChange);

function onOrientationChange(event:StageOrientationEvent):void {

     trace("onOrientationChange:"+event.afterOrientation);

    ...and process result.

    }

}

Thanks,

Alfred

TOPICS
Development

Views

2.6K

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

correct answers 1 Correct answer

LEGEND , May 05, 2011 May 05, 2011

StageOrientationEvent.ORIENTATION_CHANGE and StageOrientationEvent.ORIENTATION_CHANGING are not part of the supportedOrientations API. If you want to prevent Portrait, you can do that like this:

stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, orientationChanging);

private function orientationChanging(e:StageOrientationEvent) {

if (e.afterOrientation == "default" || e.afterOrientation == "upsideDown") {

e.preventDefault();

}

}

That trick will work with AIR 2.0 as well as AIR 2.6,

...

Votes

Translate

Translate
Adobe Employee ,
Mar 29, 2011 Mar 29, 2011

Copy link to clipboard

Copied

Right click the Project->Properties->Flex Library Compiler.

In the Additional compiler arguments, you need to append -target-player=11.

Build the preject again.

I hope it solves your problem.

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
New Here ,
Mar 29, 2011 Mar 29, 2011

Copy link to clipboard

Copied

Thanks, but I'm on Flash CS 5, not Flex.

It has Pubish Settings, but I don't know where to fill in this flag.

Thanks anyways.

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 ,
May 05, 2011 May 05, 2011

Copy link to clipboard

Copied

StageOrientationEvent.ORIENTATION_CHANGE and StageOrientationEvent.ORIENTATION_CHANGING are not part of the supportedOrientations API. If you want to prevent Portrait, you can do that like this:

stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING, orientationChanging);

private function orientationChanging(e:StageOrientationEvent) {

if (e.afterOrientation == "default" || e.afterOrientation == "upsideDown") {

e.preventDefault();

}

}

That trick will work with AIR 2.0 as well as AIR 2.6, and without requiring player 11.

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 30, 2011 Jun 30, 2011

Copy link to clipboard

Copied

Hi.

somehow I have a Problem with this sollution because the StageOrientationEvent.ORIENTATION_CHANGING does'nt get triggerd.

The ORIENTATION_CHANGE works fine but.

Using Flash 5.5. on Android with Air 2.7.0.1948.

Please help, I'Am going crazy right now!

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 30, 2011 Jun 30, 2011

Copy link to clipboard

Copied

ORIENTATION_CHANGING does not get fired on AIR on Android.

Please see http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/StageOrientationEven...

-Pahup

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 30, 2011 Jun 30, 2011

Copy link to clipboard

Copied

Wow. Thats ... bad. Any other workarounds to get the rotation event without changing the orientation automaticly?

ok i make it that way now

http://www.adobe.com/jp/joc/devnet/air/articles/air_android_orientation2.html

is it a hardware issue that it does not work on android? oder the os?

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
Mentor ,
Jun 30, 2011 Jun 30, 2011

Copy link to clipboard

Copied

LATEST

It is an OS issue, AFAIK. If you are just trying to detect orientation, you can use the accelerometer (which is probably what the article you mention is suggesting). Note that if auto-orientation IS on, the accelerometer axes are also re-oriented. You are also limited on which orientations you can set manually on Android (another OS limitation).

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