Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8086131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:21:24+00:00 2026-06-05T18:21:24+00:00

I’m working with FlashBuilder 4.6 to develop Android app. In the application there is

  • 0

I’m working with FlashBuilder 4.6 to develop Android app.
In the application there is a requirement of setting some values when device orientation changes. i.e. setting the values when the screen/device orientation changes from Landscape to Portrait and vice-verse.

Although Initially my application has LandScape orientation. And this requirement is on specific view.

I want every time when the screen/device orientation changes the values must be set there.
I am not getting the desired result.
Please guide me and tell me if I am at wrong in code or how can i achieve this.

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" title="{data}" 
        xmlns:mx="library://ns.adobe.com/flex/mx"
        viewActivate="view1_viewActivateHandler(event)"
        creationComplete="view1_creationCompleteHandler(event)">
<fx:Script>
   <![CDATA[
protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void
{
    if(Accelerometer.isSupported)
    {
    accl = new Accelerometer();
        accl.addEventListener(AccelerometerEvent.UPDATE,update);                //accl.addEventListener(AccelerometerEvent.UPDATE,adjustImage);
    }
}
private function update(event:AccelerometerEvent):void
{
     this.stage.autoOrients = true;
     //in the below line I am attaching StageOrienationEvent that will adjust the 
     //values.
     stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE,adjust);
}
private function adjust(event:StageOrientationEvent):void
{
     if(event.afterOrientation == StageOrientation.ROTATED_LEFT)
     {
    testVal.text ="After OR is LEFT";
     }
     else if(event.afterOrientation == StageOrientation.ROTATED_RIGHT)
     {
    testVal.text ="After OR is RIGHT"; 
     }
     else if(StageAspectRatio.LANDSCAPE)
     {
    testVal.text ="StageAspectRatio is Landscape";
     }
     else if(StageAspectRatio.PORTRAIT)
     {
    testVal.text="StageAspectRatio is  Portrait";
     }
}

</fx:Script>

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T18:21:25+00:00Added an answer on June 5, 2026 at 6:21 pm

    Finally found the solution after spending two days on this.

    in update function add OrientationChanging Event in stage.addEventListner.

    private function update(event:AccelerometerEvent):void
    {
      this.stage.autoOrients  = true;
      stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGING,adjust);
    }
    
    private function adjust(event:StageOrientationEvent):void
    {
      switch(event.afterOrientation)
      {
        case StageOrientation.DEFAULT:
           //Do Something here. The Portrait Position.
             break;
        case StageOrienatation.ROTATED_LEFT:
          //Do Something here when you rotate your phone portrait to left side.
           break;
        case StageOrienatation.ROTATED_RIGHT:
          //Do something here when you rotate your phone portrait to right side.
           break;
      }
    }
    

    Many thanks to all who viewed this question and try put their efforts for solution. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.