LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




ReplyREPLY THREAD
 
Thread Tools Display Modes
  #1  
Old 02-14-2012, 03:06 PM
FlashMove's Avatar
FlashMove FlashMove is offline

FlashMove Master
 
Join Date: Jan 2000
Location: Singapore
Posts: 4,597
Rep Power: 10
FlashMove is on a distinguished road
Source Detecting Mobile Screen Rotation with Flash AS3

You might have always taken for granted that life was a bed of roses when you developed a mobile app using Flash IDE that you did think orientation would be automated. Well you are only half right.
The fact that you can set auto orientation in Flash is true, but then how does your application know it?
Well here are some codes to make your life closer to a bed of roses.

Actionscript:
package {
import flash.events.Event;
    class Main
    {
        var currentState:String;
        public function Main()
        {
            setOrientation();
            stage.addEventListener(Event.RESIZE, onStageResized);
        }

        private function onStageResized(e:Event):void
        {
            setOrientation();
        }

        private function setOrientation():void
        {
            if (stage.width>stage.height)
            {
                this.currentState="landscape";
            } else {
                this.currentState="potrait";
            }
        }
    }
}
__________________
Actionscript tag . Donate Here . Testimonial . Join Flash Chat UserGroup . Twitter . Facebook

Last edited by FlashMove : 02-14-2012 at 03:12 PM
Reply With Quote


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Flash Builder 4.6 is now available for download FlashMove Flash Builder 0 12-05-2011 01:35 AM
Flash Music Loop CDs thebeatsuite Sound and Music 0 01-22-2007 03:27 PM
Flix 8 for Flash 8 is available on2com Flash Video 1 09-27-2005 09:54 PM
Open Letter to Macromedia molaram General Flash 10 02-18-2005 01:29 AM
Flash Cam - Screen captured tutorial software flashNewbie New Softwares 0 07-29-2001 12:03 AM




All times are GMT. The time now is 09:46 AM.