
Welcome Guest
|
#1
|
||||
|
||||
|
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";
}
}
}
}
__________________
Twitter . Last edited by FlashMove : 02-14-2012 at 03:12 PM |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |

Programming Languages
Twitter

