StageOrientation

How to stop the direction in flex?

in your - app.xml file

check that the following is defined as

true

fake
//change landscape whatever orientation you need

Tags: BlackBerry Developers

Similar Questions

  • StageOrientation - works does not correctly

    I'm trying to support the StageOrientation event but so far without success.

    Here is what I do (basically, I copied the HelloWorld code):

    ...
    
    stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, onOrientation);
    
    ....
    
    switch (stage.deviceOrientation)
    {
       case StageOrientation.ROTATED_LEFT:
       case StageOrientation.ROTATED_RIGHT:
       // portrait
       trace("portrait");
       break;
    
       default:
       // landscape
       trace("landscape");
       break;
    }
    

    Now the problem is that my output always says 'landscape' - and the Simulator seems little messed. My "parts" have all x and y, the value 0 - so they appear to the right of the upper left corner?

    I also added the following lines:

    stage.align = StageAlign.TOP_LEFT;
    stage.scaleMode = StageScaleMode.NO_SCALE;
    

    Any ideas?

    Other recent discussions have dealt with both of your questions.  Please use the search feature or the monitor recent discussions.

    stage.deviceOrientation is still unknown at this timeand we do not know why.  Use the deprecated stage.orientation, until it is resolved.

    The problem with rotation and reduced application is a known issue, likely to be fixed in the next version.  For now, the workaround is to drag it up to display the icons, then simply click on the application reduced to restore in the new orientation.

  • Definition of PB orientation

    Hi, I've browsed the forum but did not find the total answer about how you can set the PB orientation (landscape/portrait) and (temporarily) preventing modification by using code.

    I want to achieve the following: when using my application is launched by the user, I want to set the PB in landscape mode (if it is in portrait mode) and prevent the change of orientation portrait until opens the help screen. When the closed user assistance (by a button label) rotation must be helped again.

    I tried the following, where assistance is requested by the user code (I display an image of landscape size showing the help):

    private function onHelpClicked (event:Event) : void
    {
        stage.setOrientation(StageOrientation.DEFAULT);
    
        stage.autoOrients = false;
    
        ...
    }
    

    And when the closed user help, I set stage.autoOrients to true.

    The thing that doesn't work is the setOrientation. At least in the simulator when the PB is in portrait mode and help is called, the orientation changes to the landscape.

    Any ideas how to solve this problem?

    Not sure that this is possible, since the orientation setting is made in the configuration XML files. You can submit a feature request for this.

  • BB10 Orientation change

    Hey everyone, I looked and found nothing of the sort that has been useful. Basically I'm migrating my Playbook to BB10 app, but I have problems with the direction of switching. On the playbook, I used stage.setOrientation (StageOrientation.DEFAULT); and stage.setOrientation (StageOrientation.ROTATED_RIGHT); and it has worked very well for the playbook, but on the BB10, this seems not to work at all. false this setting was the same for both devices.

    Thanks in andvance and happy holidays to all

    Although this solution solves some of the problems that's not really change the orientation. I have a call of qnx event for a toolbar at the top of the screen which should always be above the current value of orientation.

    I think I've solved my problem by using stage.setAspectRatio (StageAspectRatio.PORTRAIT);
    stage.setAspectRatio (StageAspectRatio.LANDSCAPE); with my current code.

  • Wait for the rotation - problem with vertical centering

    What is the event to listen to determine the screen shot? I swore I saw someone talking before but search brings nothing relevant.

    I use x are coordinates for my layout and I have my coord y the value 10, which is excellent in landscape mode. When I turn to portrait, everything is centered vertically, which isn't what I want. I guess I need to listen to the rotation and change my details, but even when I start mode portrait and deply then the app, everything is still smack in the middle (vertically speaking) of the Simulator. I can't understand why this is.

    Hey miss breeder,.

    I was not completely successful with my orientation, but this is what I tried and got some sort of results. the only thing that is a problem, is that the fonts are appearing (possible incorporation question). but the listener is in the code and so here's the function:

    package
    {
        import flash.display.Sprite;
        import flash.display.StageAlign;
        import flash.display.StageOrientation;
        import flash.display.StageScaleMode;
        import flash.events.StageOrientationEvent;
    
        [SWF(width="1024", height="600", backgroundColor="#999999", frameRate="30")]
        public class SampleTest extends Sprite
        {
            public function SampleTest()
            {
                super();
    
                // support autoOrients
                stage.align = StageAlign.TOP_LEFT;
                stage.scaleMode = StageScaleMode.NO_SCALE;
    
                stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, onOrientationChange);
    
            }
    
            protected function onOrientationChange(e:StageOrientationEvent):void
            {
    
                if (e.afterOrientation == StageOrientation.ROTATED_LEFT)
                {
    
                    this.rotation = -90;
    
                    this.x = 0;
                    this.y = 1024;
    
                }
                else if (e.afterOrientation == StageOrientation.DEFAULT)
                {
                    this.rotation = 0;
    
                    this.x = 0;
                    this.y = 0;
                }
            }
        }
    }
    

    hope that helps some. Good luck!

  • (Landscape) Mobile home screen do not size correctly when the device is held in Portrait

    I have a mobile project (AIR) for iPad and iPhone that has startup landscape screens when the user clicks on the icon. However, when the user is now the camera in portrait mode, image of the start screen opens and resizes an image of landscape in portrait mode. Looks really bad too! I have only provided images of the landscape. -Does anyone know what is happening here?

    What is your picture of app support? If so, you should provide the necessary portrait icons.

    If this isn't the case, you must restrict your apps orientation. An event is raised offshore on the orientation change that gives you a chance to control:

    http://help.Adobe.com/en_US/FlashPlatform/reference/ActionScript/3/Flash/events/StageOrien tationEvent.html

    In my landscape only applications, it is specified in the XML application, and then I simply listen to changes. for example

    Listen for a change in direction

    stage.addEventListener (StageOrientationEvent.ORIENTATION_CHANGING, _orientationChangeHandler);

    neglect no change orientation, which is not the landscape

    function _orientationChangeHandler(e:StageOrientationEvent):void

    {

    If (e.afterOrientation == StageOrientation.DEFAULT | e.afterOrientation == StageOrientation.UPSIDE_DOWN)

    {

    e.preventDefault ();

    }

    }

    Even if it is not even necessary more, the XML should really allow orientation specification limits as well as the limits of the device. That code allows the user to use the landscape or landscape upside (requires Apple) and neglects to portrait or portrait upside.

  • UIInterfaceOrientation layout for my iOS to Adobe Air app

    Hello

    I tried to add UIInterfaceOrienation to my app.xml but it gives me error 'application.iPhone.InfoAdditions contains an invalid value' when I try to create a package of iOS.


    This is what looks like the app.xml

    < iPhone >

    < InfoAdditions >

    <! [CDATA]

    ... other values

    < key > UIInterfaceOrientation < / key >

    < string > UIInterfaceOrientationLandscapeRight < / string >

    []] >

    < / InfoAdditions >

    Any ideas?

    Thank you

    OK, got a response.

    Apparently, we cannot do this via the air conditioner (again?)

    The solution above works only with developing native

    contextView.stage.autoOrients = false;

    contextView.stage.setOrientation (StageOrientation.ROTATED_LEFT);

    contextView.stage.setOrientation (StageAspectRatio.LANDSCAPE);

    voila

    Note, that a ROTATED_LEFT makes 'straight' upward

  • Mobile direction

    Hello friends,

    I work with FlashBuilder 4.6 to develop Android app.

    In the application, it is necessary to set some values when change of orientation of the device. i.e. setting the values when the orientation of the screen/device changes from landscape to Portrait and vice-verse.

    Although initially my application has Landscape orientation . And this requirement is specific showing.

    I want every time when the orientation of the screen/device change values must be set to one.

    I don't get the desired result.

    Please guide me and tell me if I'm wrong in the 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 threshold, I enclose StageOrienationEvent allowing to adjust the
    // values.
    stage.addEventListener (StageOrientationEvent.ORIENTATION_CHANGE, adjust);

    }

    Private void adjust (event: StageOrientationEvent):void

    {

    if (event.afterOrientation is StageOrientation.ROTATED_LEFT)

    {

    "testVal.text ="""OR after is the LEFT ';

    }

    else if (event.afterOrientation is StageOrientation.ROTATED_RIGHT)

    {

    "testVal.text ="""OR after is RIGHT ';

    }

    else if (StageAspectRatio.LANDSCAPE)

    {

    "testVal.text ="""StageAspectRatio is landscape ';

    }

    else if (StageAspectRatio.PORTRAIT)

    {

    "testVal.text ="""StageAspectRatio is the Portrait ";

    }

    }

    < / fx:Script >

    Finally found the solution after spending two days on that.

    Depending on the update adds Event OrientationChanging in stage.addEventListner.

    protected function update(event:AccelerometerEvent):void

    {

    this.stage.autoOrients = true;      stage.addEventListener (StageOrientationEvent.ORIENTATION_CHANGING, adjust);

    }

    protected 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 on the left side portrait.

    break;

    case StageOrienatation.ROTATED_RIGHT:

    Do something here when you rotate your phone right portrait.

    break;

    }

    }

    Many thanks to all who have seen this issue and try to put their efforts for the solution.

  • Oriantation on iPad

    Hello

    I'm builting an app for ipad using flash cs5.5.

    I want the demand for labour in the landscape always, so I made the following settings in the ipad.

    Image format: landscape

    Fullscreen: true

    Auto focus: true

    Rendering: Auto

    Device: iPad

    But still it direct to the Portrait. Please let me know if there is another option that I need to configure it so that it will not for the portrait.

    Thanks - Amit

    Hello

    Found a solution...

    Turn off automatic orientation and use the following code.

    stage.addEventListener (Event.ENTER_FRAME, refreshOrientation, false, 0, true);

    var number: Number = 0;

    function refreshOrientation(theStage:Event):void

    {

    Number = number + 1;

    Numberis.Text = String (number);

    Switch (stage.deviceOrientation)

    {

    case StageOrientation.ROTATED_RIGHT:

    stage.setOrientation (StageOrientation.ROTATED_LEFT);

    break;

    case StageOrientation.ROTATED_LEFT:

    stage.setOrientation (StageOrientation.ROTATED_RIGHT);

    break;

    by default:

    No change

    }

    }.

  • Ice Cream sandwich plus stage text is no go?

    My boss just got the new Google Nexus phone on giant screen, I think that the first phone to run the OS ice cream sandwich.

    In any case he tried a soft we recently and it was running fine on all phones and tablets we tested on but on ICS once the Send button is hit and stage text is due to appear the screen turns white, sweeping gestures still work and other executives work very well have no text step It's the only thing I can think of.

    I will try to rebuild the application with no text on the stage, but it's a great nuisance. If someone wants to check the app you can get it on the link below.

    https://market.Android.com/details?ID=air.com.toyotaforklift.calculatorphone

    or

    https://market.Android.com/details?ID=air.com.toyotaforklift.calculatortablet

    Not sure if the new screen phone crazy high resolution is considered a Large or XLarge screen Android.

    According to me, the app was built with AIR 3.0, do not think that I have this pc on 3.1, can be worth it.

    Something about these lines:

    import flash.desktop.NativeApplication;

    import flash.system.Capabilities;

    import flash.events. *;

    import flash.display.StageOrientation;

    private var startOrientation:String = stage.orientation;

    If (Capabilities.cpuArchitecture == 'ARM') {}

    NativeApplication.nativeApplication.addEventListener (Event.ACTIVATE, handleActivate, false, 0, true);

    NativeApplication.nativeApplication.addEventListener (Event.DEACTIVATE, handleDeactivate, false, 0, true);

    }

    private void handleActivate(event:Event):void {}

    stage.setOrientation (startOrientation);

    }

    private void handleDeactivate(event:Event):void {}

    }

    The idea is to set the direction of what it was at the start of the application and the confidence that Flash managed to start in the right direction. You can wait for a resize event before setting this value, if you encounter any problems.

    The reason why you cannot use:

    stage.setOrientation (StageOrientation.ROTATED_RIGHT);

    is because the orientation is landscape on Android phones and tablets, but portrait on other tablets.

  • StageOrientationEvent.ORIENTATION_CHANGE do not send

    Hello!

    Why in my Mobile Application is not sending the StageOrientationEvent event?

    What's wrong?

    I put in my project "automatically redirect.

    This is my opinion:

    <? XML version = "1.0" encoding = "utf-8"? >

    " < = xmlns:fx s:View ' http://ns.Adobe.com/MXML/2009 "

    xmlns:s = "library://ns.adobe.com/flex/spark" title = "HomeView" creationComplete = "view1_creationCompleteHandler (event)" >

    < fx:Script >

    <! [CDATA]

    Mx.events import. *;

    Import mx.events.StateChangeEvent;

    Import mx.states.AddChild;

    protected function view1_creationCompleteHandler(event:FlexEvent):void {}

    addEventListener (StageOrientationEvent.ORIENTATION_CHANGE, changeOrientationListener)

    }

    protected function changeOrientationListener(event:Event):void {}

    trace (Event)

    }

    []] >

    < / fx:Script >

    < / s:View >

    Thank you

    Resolved:

    http://ns.Adobe.com/MXML/2009.

    xmlns:s = "library://ns.adobe.com/flex/spark" title = "HomeView" creationComplete = "view1_creationCompleteHandler (event)" > "

    Mx.events import. *;

    protected function view1_creationCompleteHandler(event:FlexEvent):void {}

    addEventListener (Event.ADDED_TO_STAGE, _onAddedToStage)

    }

    private void _onAddedToStage(event:Event):void {}

    If (stage.autoOrients)

    stage.addEventListener (StageOrientationEvent.ORIENTATION_CHANGE, _onStage_OrientationChange);

    }

    private void _onStage_OrientationChange(event:StageOrientationEvent):void {}

    {Switch (Event.afterOrientation)}

    case StageOrientation.DEFAULT:

    trace ('DEFAULT')

    break;

    case StageOrientation.ROTATED_RIGHT:

    trace ('ROTATED_RIGHT')

    break;

    case StageOrientation.ROTATED_LEFT:

    trace ('ROTATED_LEFT')

    break;

    case StageOrientation.UPSIDE_DOWN:

    trace ('UPSIDE_DOWN')

    break;

    case StageOrientation.UNKNOWN:

    trace ('UNKNOWN')

    break;

    }

    }

    ]]>

  • Strange behavior of StageOrientationEvent

    Don't like not bringing this up again, but I was ripping my hair out trying to get to the bottom of the present.

    We are developing a game that must be submitted to the apple app store, so we must also support the two possible landscape modes.

    I use the mentioned here http://forums.adobe.com/message/4007439#4007439 and here http://www.adobe.com/devnet/flash/articles/screen_orientation_apis.html extracts but so far there is nothing to prevent the application to use the portrait when he feels like he wants to.

    Two special mentions,

    During the test on android and listen to StageOrientationEvent.ORIENTATION_CHANGING I get nothing. This event just does not at all.

    However, StageOrientationEvent.ORIENTATION_CHANGE is raised. If I try to intercept the following

    If (e.afterOrientation == StageOrientation.DEFAULT |) StageOrientation.UPSIDE_DOWN)

    {

    e.preventDefault ();

    }

    It prevents the rotation of phase on the first event, but on other changes, he seems to ignore preventDefault(); and jumps to one of the modes portrait.

    I am currently debugging on an iPad as well, but can not see the tracks again. Be that as it may, none of these methods seems to give the required (or in fact necessary) behavior.

    I have broken out just those bits to a separate test application to test and am happy that fall somewhere if anyone can suggest a fix.

    In the meantime advice at all greatly would receive. Thanks in advance,

    Mark

    The code I posted in the linked discussion works every time for me on my iPad. I'm under AIR 2.6 If... maybe you can try to compile in this and see if it works? The only other thing I can think to suggest is to make sure that autoOrients is set to true in your descriptor of the app.

  • Flex Mobile: Prevent focus on points of view

    If a mobile application has 4-5 views, is there a way to toggle the orientation (portrait/landscape) for some of the points of view?

    Add a listener for events on the event activate (or creationComplete) from your point of view and the view deactivate event.

    In these event listeners, add these lines:

    protected function view_activateHandler(event:Event):void

    {

    stage.autoOrients = false;

    }

    protected function view_deactivateHandler(event:Event):void

    {

    stage.autoOrients = true;

    }

    You can then manually verify or set the orientation with stage.orientation == StageOrientation.ROTTED_LEFT and stage.setOrientation (StageOrientation.DEFAULT) for example.

  • prevent the landscape

    So I know that I can add this code to avoid the portrait mode

    import flash.display.StageOrientation;

    var startOrientation:String = stage.orientation;

    If (startOrientation == 'default' | startOrientation == 'upside down')

    {

    stage.setOrientation (StageOrientation.ROTATED_RIGHT);

    }

    on the other

    {

    stage.setOrientation (startOrientation);

    }

    stage.addEventListener (StageOrientationEvent.ORIENTATION_CHANGING, orientationChangeListener);

    function orientationChangeListener(e:StageOrientationEvent)

    {

    if (e.afterOrientation == 'default' | e.afterOrientation == 'upside down')

    {

    e.preventDefault ();

    }

    }

    What is the landscape equivalent of preventDefault? I cs5.5 then uses air 2.6. I know before there was a workaround solution where you can set the orientation to publish in landscape mode but I guess you don't need to do it now?

    While what you say is true, it is a requirement of the iPad applications that you support changes in the necessary guidance. In other words, you may not penalize a person who likes to exploit their iPad with button at the top at home.

    Regarding the verification of landscape, you can either use the controls for the portrait and do nothing, but make a preventDefault in the Else part of the If statement, or you can use the constants instead of the string for the audit. So, look for StageOrientation.ROTATED_RIGHT and StageOrientation.ROTATED_LEFT instead of "rotatedRight" and "rotatedLeft". Just in case where channels are not what you think they are.

Maybe you are looking for

  • Why my Apple Watch impute watch OS 2.2.1 update tp?

    I have the Apple Watch 42 MM Edition gold with black classic loop running watch OS 2.2, and I wanted to update to 2.2.1 watch OS even if it is fully charged and disconnected, just like the iPhone, you can remove the load and updated, but I don't know

  • Since the upgrade to El Capitan can eject disks

    I find myself unable to eject the hard disks and flash drives. I'm a photographer and I regularly load for clients flash drives, this is usually a fast CAP, copy photos, eject, and move on to the next thing. I can't stop my MBP whenever I need to eje

  • I want to host my shared on a cRIO Variables, but use DSC to recording/alarm/SCADA

    Hello world What I try to do is the following: -Host variable static on my goals of RT (cRIO-9022) for reliability -Use the DSC module to log on to the database, followed by alarms, develop a distributed HMI The problem that I am running is that the

  • I forgot the password of the only administrator account on Vista

    I forgot the password for the administrator account only on Vista and the hidden administrator account does not appear in safe mode. What are my options?

  • After 12.1.1 vms upgrade not available locally

    The host is Windows 7.  Has started the upgrade to 12.1.1 build-3770994.  The operation failed due to a permissions problem, I wasn't the admin, wasn't an admin role.   Then he took the 12.0 installation.   Installed 12.1.1 of the binary installation