Flex mobile orientation: force portrait mode and then allow auto orientation

I'm creating a flex mobile project and I want to force the app to portrait orientation when I click a button, and when I click other button allow again to change the orientation.
This is my code when I click the first button, where I want to force portrait mode:
protected function click(event:MouseEvent):void{      if(stage.orientation != StageOrientation.DEFAULT){           stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientationChanged);           stage.setOrientation(StageOrientation.DEFAULT);      }else{           doSomething();      }  }  
private function orientationChanged(event:StageOrientationEvent):void{      doSomething();      stage.removeEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientationChanged); } 
private function doSomething():void{      stage.autoOrients = false; }
It works ok and it changes the orientation if it's needed.
Now, when I want to allow orientation change again, I've only putted:
stage.autoOrients = true;
It works ok if when I click the first button the app is in portrait and it doesn't have to change anything. But if it's on landscape and it have to change to portrait, when I allow orientation change again, it doesn't work ok.
Do you know if I have to allow or change something? Or, is there any better way to do this?
Thanks in advance

Thanks for your answer. It works, but I have the same problem that I have setting the orientation. If I'm on landscape, it changes to Portrait ok, but when I want to allow auto orientation again, it doesn't work well.
A little tricky I've found is:
When I want to force to portrait:
private var oldOrientation:String = null;
protected function click(event:MouseEvent):void{
   if(stage.orientation != StageOrientation.DEFAULT){
            oldOrientation = stage.orientation;
            stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientationChanged);
            stage.setOrientation(StageOrientation.DEFAULT);
   }else{
            doSomething();
private function orientationChanged(event:StageOrientationEvent):void{
            // do something if you are changing to portrait mode (the first change) and other thing if you are changing to old orientation
And when I want to allow auto orientation again:
if(oldOrientation != null){
        stage.setOrientation(oldOrientation);
        oldOrientation = null;             

Similar Messages

  • ITUNES WONT OPEN UNLESS I GO INTO SLEEP MODE AND THEN WAKE.

    I recently update to itunes 11. the problem is when it wont open unless i go into sleep mode and then wake the pc from it. Steps first double click on itunes to open it. nothing pops up. in task manager it shows that itunes is running. i press the power button to put the laptop into sleep mode. after about a minute i wake the computer again. wallah itunes is suddenly open. its almost as the sleep mode allows it to open. i dont know what to do ive tried everything. HELP PLEASE!!

    ive tried uninstalling and reinstalling. ive tried messing around with bootup prefs. ive tried to see what apple services should be running. ive tried end task itunes then end task other prgrams and tried to open it again. ive tried deleting the sc info folder.

  • Mine is not a question but I received the solution to the iphone 4s not discovering bluetooth, you hold the top button and the home button until the apple logo comes up and then let it reboot, put your bluetooth in pairing mode, and then turn on bluetooth

    My new iphone 4s would not discover bluetooth.  I called apple, and the guy was great!!!  He told me to hold the top button and the home button together and do not let go until the apple logo came up, this would do a hard reset.  Then when it reboots, you turn on your bluetooth in paring mode, and then turn on the bluetooth on your iphone 4s and it will find your bluetooth device.  Simple, yet it works!!!  Hope this helps those of you having the same problem I was having trying to connect your bluetooth. 

    My new iphone 4s would not discover bluetooth.  I called apple, and the guy was great!!!  He told me to hold the top button and the home button together and do not let go until the apple logo came up, this would do a hard reset.  Then when it reboots, you turn on your bluetooth in paring mode, and then turn on the bluetooth on your iphone 4s and it will find your bluetooth device.  Simple, yet it works!!!  Hope this helps those of you having the same problem I was having trying to connect your bluetooth. 

  • TS3274 My Ipad display is stuck on portrait mode. I tried the toggle switch, turning off and restart and just now backed up into Itunes and restored and still is stuck on portrait mode and it won't flip to landscape mode. Is this a hardware problem?

    My Ipad display is stuck on portrait mode. I tried the toggle switch, turning off and restart and just now backed up into Itunes and restored and still is stuck on portrait mode and it won't flip to landscape mode. Is this a hardware problem?

    Has lock rotation been accidentally enabled within the control centre? If you swipe up the screen is there a circle with a lock symbol & if so is is greyed out or white - if white it is enabled.

  • Ipad displays "ipad is disabled connect to itunes", I have tried putting the ipad into recovery mode and then restoring but that does not work. I have also tried doing a hard reset of the ipad and that does not work either. Any ideas?

    Ipad displays “ipad is disabled connect to itunes”, I have tried putting the ipad into recovery mode and then restoring but that does not work. I have also tried doing a hard reset of the ipad and that does not work either. Any ideas?
    My son let one of his friends use his ipad. The next time he tired to use it he could not get it unlocked, I tired to unlock it but it kept telling me that I had the wrong pass code. With out me knowing my son continued to tire until it completely disabled it self.

    How can I unlock my iPad if I forgot the passcode?
    http://www.everymac.com/systems/apple/ipad/ipad-troubleshooting-repair-faq/ipad- how-to-unlock-open-forgot-code-passcode-password-login.html
    iOS: Device disabled after entering wrong passcode
    http://support.apple.com/kb/ht1212
    How can I unlock my iPad if I forgot the passcode?
    http://tinyurl.com/7ndy8tb
    How to Reset a Forgotten Password for an iOS Device
    http://www.wikihow.com/Reset-a-Forgotten-Password-for-an-iOS-Device
    Using iPhone/iPad Recovery Mode
    http://ipod.about.com/od/iphonetroubleshooting/a/Iphone-Recovery-Mode.htm
    You may have to do this several times.
    Saw this solution on another post about an iPad in a school environment. Might work on your iPad so you won't lose everything.
    ~~~~~~~~~~~~~
    ‘iPad is disabled’ fix without resetting using iTunes
    Today I met my match with an iPad that had a passcode entered too many times, resulting in it displaying the message ‘iPad is disabled – Connect to iTunes’. This was a student iPad and since they use Notability for most of their work there was a chance that her files were not all backed up to the cloud. I really wanted to just re-activate the iPad instead of totally resetting it back to our default image.
    I reached out to my PLN on Twitter and had some help from a few people through retweets and a couple of clarification tweets. I love that so many are willing to help out so quickly. Through this I also learned that I look like Lt. Riker from Star Trek (thanks @FillineMachine).
    Through some trial and error (and a little sheer luck), I was able to reactivate the iPad without loosing any data. Note, this will only work on the computer it last synced with. Here’s how:
    1. Configurator is useless in reactivating a locked iPad. You will only be able to completely reformat the iPad using Configurator. If that’s ok with you, go for it – otherwise don’t waste your time trying to figure it out.
    2. Open iTunes with the iPad disconnected.
    3. Connect the iPad to the computer and wait for it to show up in the devices section in iTunes.
    4. Click on the iPad name when it appears and you will be given the option to restore a backup or setup as a new iPad (since it is locked).
    5. Click ‘Setup as new iPad’ and then click restore.
    6. The iPad will start backing up before it does the full restore and sync. CANCEL THE BACKUP IMMEDIATELY. You do this by clicking the small x in the status window in iTunes.
    7. When the backup cancels, it immediately starts syncing – cancel this as well using the same small x in the iTunes status window.
    8. The first stage in the restore process unlocks the iPad, you are basically just canceling out the restore process as soon as it reactivates the iPad.
    If done correctly, you will experience no data loss and the result will be a reactivated iPad. I have now tried this with about 5 iPads that were locked identically by students and each time it worked like a charm.
    ~~~~~~~~~~~~~
    Try it and good luck. You have nothing more to lose if it doesn't work for you.
     Cheers, Tom

  • When i put firefox in offline mode, and then click on pages saved in history , it can't load any pages or any images. i put cach size to 250mb but the problem is the same, it saves history for two months, but can't load pages.

    when i put firefox in offline mode, and then click on pages saved in history , it can't load any pages or any images. i put cach size to 250mb but the problem is the same, it saves history for two months, but can't load pages.

    Hi there,
    When I inspect your site in browser tools, I'm getting 404 errors from your page:
    [Error] Failed to load resource: the server responded with a status of 404 (Not Found) (jquery-2.0.3.min.map, line 0)
    [Error] Failed to load resource: the server responded with a status of 404 (Not Found) (edge.4.0.0.min.map, line 0)
    BarnardosIreland wrote:
    I would have thought that publishing should give a complete package that doesn't need any further edits to the code and can just be directly ftp'ed to the web - is this correct?
    In general, you are correct - but also your server does need to be properly configured (and those errors above lead me to think it may not be) to serve the file types that your uploading - but it could be something else entirely. Can you zip up your composition folder, upload it to your Creative Cloud files, set it to share, and then post a link here so I can download it? If you'd rather not share it publicly, can you PM me with a link to your composition files?
    Thanks,
    Joe

  • IPhoto just stopped working. It loads pictures, but then goes into rainbow wheel forever. Then I try to force quit it, and then the whole Mac hangs up (had to power cycle it to get it back). I am using OS 10.5.8, and when I run software update, it assures

    iPhoto just stopped working. It loads pictures, but then goes into rainbow wheel forever. Then I try to force quit it, and then the whole Mac hangs up (had to power cycle it to get it back). I am using OS 10.5.8, and when I run software update, it assures me I have up to date software. I have not added any photos since the last time I used it, probably less than a month ago. What gives?

    Try these in order - from best option on down...
    1. Do you have an up-to-date back up? If so, try copy the library6.iphoto file from the back up to the iPhoto Library allowing it to overwrite the damaged file.
    2. Download <a href="http://www.fatcatsoftware.com/iplm/"><b><u>iPhoto Library Manager</b></u></a> and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.
    3. If neither of these work then you'll need to create and populate a new library.
    To create and populate a new *iPhoto 6* library:
    Note this will give you a working library with the same Rolls and pictures as before, however, you will lose your albums, keywords, modified versions, books, calendars etc.
    Move the iPhoto Library to the desktop
    Launch iPhoto. It will ask if you wish to create a new Library. Say Yes.
    Go into the iPhoto Library on your desktop and find the Originals folder. From the Originals folder drag the individual Roll Folders to the iPhoto Window and it will recreate them in the new library.
    When you're sure all is well you can delete the iPhoto Library on your desktop.
    In the future, in addition to your usual back up routine, you might like to make a copy of the library6.iPhoto file whenever you have made changes to the library as protection against database corruption.

  • HT201263 Get three quarters of the way through recovery mode and then iphone goes back to "Connect to Itunes screen" can someone help please?

    Get three quarters of the way through recovery mode and then iphone goes back to "Connect to Itunes screen" can someone help please?

    Delete the .ipsw file on the computer.
    Put the device in DFU mode.
    Restore as new, once the restore completes, then try restoring from backup.

  • IOS7 forcing portrait mode

    Hi,
    I updated to iOS7 on my iPad so tht I could test the functionality of an application that is currently deployed on iOS6.  The application is published with the Landscape aspect ratio, Auto orientation unchecked and standard resolution.  When I launch the App on iOS7 it wil only display in portrait mode.  Does anyone have an explanation/solution for this?
    Best regards,
    Chris McLaughlin

    I had this same issue with two of our apps that were compiled a long time ago under AIR 3.6 and did NOT use Native Extensions (and thus were linked against an older version of the Apple iOS SDK).
    Two of our apps supported landscape only, but on iOS7 they displayed in portrait mode, so most of the UI wasn't visible and the apps became unusable under iOS7.
    After I rebuilt them under AIR 3.8 & 3.9, they correctly displayed in landscape mode, but with one small caveat that I encountered. The new version of the apps (under Air 3.8) would launch upside down on iOS7, but only when the home button of the device was on the left.
    I eventually fixed the issue by adding a Native Extension and then linking that native extension against the Apple iOS5 SDK. When nothing was specified for the Apple iOS SDK, the app would launch upside down. After linking to iOS5 SDK the problem went away.
    You can specify the Apple iOS SDK in :
    Project->Properties->ActionScript Build Packaging->iOS->NativeExtensions->Apple iOS SDK.

  • [Lollipop] Turning Auto-rotate off forces portrait mode

    In various situations, I like to use my tablet in landscape mode, but turn auto-rotate off (watching movies/streams while lying down).
    I do this using the pull-down quick menu. After the update to lollipop however, whenever I turn off "Auto-rotate", the button's name will switch to "Portrait" and my tablet (and app) will rotate into portrait mode, even if it was in landscape mode when I pressed the button. I reckon this is done with e-books in mind, but for my purposes this makes this feature useless.
    Is there any way to restore the original behaviour (tablet stays in the orientation it was in when you decide to turn off Auto-rotate)? If there is not currently, I urge you to change it back to the old way (other lollipop tablets seem to have the old behaviour still from what I could gather from friends).

    uliwooly wrote:
    That's the way it's supposed to work 
    Well, that just sounds like an opinion. Do you have any source for that? As I said, my friends' other tablets behave differently.
    Is there anyone from Sony around who can shed some light on this or make inquiries? Or is this a users-help-users-only support forum?
    And @Johnny_dee, please don't hijack threads. The whole discussion now is about a whole other topic. Just open a new topic.
    (maybe some nice moderator could split the topic?)

  • Startup gets past Dell logo to Windows logo, but not further unless I put it to sleep mode and then wake up

    Hi guys, new to the forum and very much hoping to get help to the following problem:
    I'm experiencing a very unusual problem that I've never encountered before nor read about anywhere on the internet. After installing a clean install of Windows 8 on my Dell Inspirion N5050, startup does get past the Dell logo and onto the Windows loading logo.
    However, it won't go further than this. The logo goes away, leaving the screen blank (NOT black) and it won't continue to the logon page or start menu. All lights are burning (meaning it's working somewhere underneath that weird blank screen). And the funny
    thing is that when I press the power button (or close the lid) to put it to sleep and then wake it up by pressing again, the logon/start menu is there and Windows is working perfectly.
    In short: everything works perfectly, except that I have to put the computer to sleep and wake it back up in order for me to see/get into windows.
    Has anyone heard of this problem before? I'm so utterly confused here!
    Thanks so much in advance!
    Rose

    Hi,
    This issue can be caused by failing to load files or drivers.
    First, I suggest you to try to boot into Safe mode, and shut down and power on to see if there is the same issue:
    Please use these steps to boot into Safe mode:
    Windows key + Run -> Type msconfig, and press Enter -> Under Boot tab, check on “Safe boot” -> Click Ok to restart computer.
    To disable boot into safe mode automatically, repeat above steps  and uncheck the Safe boot option.
    If the issue not persists, please try to disable fast startup to make sure all the drivers were load properly and check the results:
    How to Turn "Fast Startup" On or Off for a Hybrid Boot in Windows 8 and 8.1
    http://www.eightforums.com/tutorials/6320-fast-startup-turn-off-windows-8-a.html
    Can we get this done?
    If the issue still persists, please post back the event log (System) here for further research:
    How to Save Event Logs
    http://msdn.microsoft.com/en-us/library/gg163107.aspx
    Meanwhile, we need to get the boot trace to see when did this issue happened:
    How to collect a good boot trace on Windows 7
    http://blogs.technet.com/b/jeff_stokes/archive/2012/09/17/how-to-collect-a-good-boot-trace-on-windows-7.aspx
    Once down, please upload the .etl file into SkyDrive or Similar ones and share the public link here for our research.
    Keep post.
    Kate Li
    TechNet Community Support

  • My 3050 J610 printer goes into standby or sleep mode and then I cannot print docs to it wirelessly

    Everytime I do not print something for a few hours, my printer goes into standby or sleep mode.  When it does this, it cannot be used to print from my laptop or android to it.  Is there a way to set this up so that it doesn't "go to sleep" and it is always available to me to print with.  I like the printer, but it seems kind of off that you cannot print on it wirelessly and it is considered a WIRELESS printer.  That's the only reason I bought it and now I can't even use it without walking downstairs and turning the printer back on again.  If I wanted to do that every time I would just print from my main computer!
    Thanks,
    Ashley
    This question was solved.
    View Solution.

    Ok, I know this thread is a little old, but it would not allow me to start a new one, since I am new. I am having the same issues with my 3050 J610 as everyone else. It makes you think there is a wireless connection problem, but that is not the case. The printer goes into a standby mode and there is no way to bring it out of it, unless you cycle the printer. The panel buttons will still work, you just lose the ability to print wirelessly.
    I have had my 3050 J610 in two different rooms, master bedroom and basement office. Both areas work well when it is connected and awake. After a while of inactivity, it goes into standby mode and cannot print wirelessly. Here are steps I have taken so far:
    When the printer goes into standby and will not print wirelessly, I have check to make sure there is still a connection between the router and the printer - There is
    I have set a static Id for the printer at .210
    Cycling the printer brings the connection back instantly.
    The front panel buttons work just fine when it does not have connectivity
    In the basement, the machine has excellent signal and connection.
    I have checked the recommendations in this thread, and like others, there are no options under the advanced tab of the maintenance page. The problem is a standby or sleep issue. When this arises, it has connection to the router, but the wireless computer does not have connection to the machine. I know when it was in the bedroom, the light would blink 3 or 4 times now and then throughout the night. We need a way to turn off the standby, or bring the machine out of standby mode. It is not an issue of the router, channel, interference, or software. It is the sole issue of standby or sleep modes. I have been pulling my hair out for almost two years over this issue. I swore I would not buy another HP product after the problems I had with a printer and laptop. But I thought I would give HP another chance.

  • Had mobile hot spot with 5g and then they moved it into my share paln

    What a rip off.  We went in to upgrade two phones..$400 and they told me I should change my family plan to a new share everything plan & it would be cheaper.  What a scam. Now I get 2 gig data to share with a mobile hot spot & 2 data phones.  The old plan had 5 g on the mobile hotspot FOR $50/MO.
    THEY DID NOT INFORM ME THAT THe HOT SPOT WOULD HAVE TO SHARE DATA WITH THE REST OF THE PHONES. Now , on day after it's too late to return the upgrade phones & go back to my old plan I GET A WARNING THAT I'M OVER THE DATA ALLOWANCE.. Customer service did nothing but charge me $ 10 more a month until the contract runs out on the hot spot and then I tell them to put it where the, take this &  you know.... the thing never worked very well in the first place. I think they should have giving me some free data for the next few month a least.  Do you think they explain the so called up grades well????

    When did the plan go into affect has it been more than 24 hours?

  • Ipad wont turn on unless i put it in dfu mode, and then it still turns off within a few minutes, ipad wont turn on unless i put it in dfu mode, and then it still turns off within a few minutes

    my ipad 2 turns off by its self, it works perfectly fine otherwise, the condition is very good and it has never been dropped or anything. it turns off by itself and then i have to put it in dfu mode and recover it to turn it back on otherwise nothing else works. once i put it in dfu mode, the ipad turns on once fully recoved and restored to orginal settings but a few minutes later the process repeats, and turns off again. any helpp?

    If your iPad is jailbroken, we can't help you.
     Cheers, Tom

  • Video support: resolution, portrait mode and aspect ratio

    I have been playing with a friend's PowerPC-based mini (while I wait for Leopard to come out) and have some pre-purchase questions:
    1) Do the current Core 2 Duo mac mini models support the VESA standard Preset Timing Mode of 1680 x 1050? (That's not listed on his older mac mini and would affect my choice of monitor.)
    2) Does the current mac mini support portrait mode with any monitor at all?
    3) The specs list maximum resolutions of 1920 x 1200 (16:10) with DVI and 1920 x 1080 (16:9) with VGA. I'm guessing that is related to bandwidth of the cable and does not mean that all output to DVI would be at the 16:10 aspect ratio and all output to VGA would be at the 16:9.

    mexibeetle,
    As far as the resolution of 1680x1050 I cannot answer you. I have a Power PC mini as well as an intel mini. The resolutions available change based on the display connected, but neither of mine offer that particular resolution (the 17" monitor I have does not go that high on the PPC mini via VGA and the intel mini is hooked up to a 40" LCD TV via HDMI...those resolutions are either 1600x900 or 1920x1080)
    Neither my monitor nor my HDTV list that particular resolution (1680x1050) as being available, regardless of what they are connected to, so I cannot say whether or not the mini is capable of driving a screen at that resolution.
    As to portrait mode, on both the older and newer minis in the display preference pane there is the option to rotate your image...90, 180 and 270 degrees. Mounting your monitor horizontal or vertical should not pose any problem as far as I can see.

Maybe you are looking for

  • Facing Problem while Displaying Russian words using HTP.TableData

    Hi, We are storing russian words in DB.While displaying these words, it is not displaying proerly.we are using "HTP.TableData" to display russian characters in the front end.Please suggest the solution to display russian words proeprly

  • Post Moved Mac Port Forwarding Issues

    Post Moved to Other BB Queries http://community.bt.com/t5/Other-BB-Queries/Mac-Port-Forwarding-issues/td-p/550779 If you want to say thanks for a helpful answer,please click on the Ratings star on the left-hand side If the reply answers your question

  • Retrieving an URL content in ABAP

    Hi Experts,     I have to read the content of http://.......... URL content to ABAP. Is there any method or function module to read?? Thanks and regards, Venkatraman.N.

  • HOW COULD CONNECT FROM SAP SYSTEM TO THIRD PARTY JAVA APPLICATION

    HI expects,         HOW COULD CONNECT FROM SAP SYSTEM TO THIRD PARTY JAVA or . DET APPLICATION.please provide me some scenarios and documents.please help me.

  • Last sentence is standing at the beginning

    Hi freinds, I have the situation the  CONCATENATion adds Strings not in right sequence. Suppose lt_longtxt has 3 entries at each concatenate it joins back to front. Because the first sentence will be joined at first and then the second sentence as th