关于获取Flex Mobile屏幕宽高

1. mobile width and height

 

import flash.display.Screen;

import flash.system.Capabilities;

 

trace(Capabilities.screenResolutionX, Capabilities.screenResolutionY, Capabilities.screenDPI);

 

trace(Screen.mainScreen.bounds.width, Screen.mainScreen.bounds.height);

 

trace(stage.fullScreenWidth, stage.fullScreenHeight);

 

2. topLevelApplication width and height

 

var application:UIComponent = FlexGlobals.topLevelApplication as UIComponent;    

 trace(application.width, application.height);

 

3. actionBar width and height

trace(FlexGlobals.topLevelApplication.actionBar.width, FlexGlobals.topLevelApplication.actionBar.height);

 

4. task bar width and height

trace(Screen.mainScreen.bounds.width, Screen.mainScreen.bounds.height);

trace(Screen.mainScreen.visibleBounds.width, Screen.mainScreen.visibleBounds.height);

trace(Screen.mainScreen.bounds.height - Screen.mainScreen.visibleBounds.height);

 

5. portrait -> landscape

var appUIComponent:UIComponent = FlexGlobals.topLevelApplication as UIComponent;

var Width:Number = Math.ceil(appUIComponent.width / Capabilities.screenResolutionX * Capabilities.screenResolutionY);

var Height:Number = appUIComponent.width;

你可能感兴趣的:(Flex,application,mobile)