读书人

关于获取Flex Mobile荧屏宽高

发布时间: 2012-09-20 09:36:50 作者: rapoo

关于获取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

热点推荐