Reputation: 109
I want to make an application with an image that only bounces to the users screen resolution. How can I go by detecting the users screen resolution in flex 4? (If you can that is.)
Upvotes: 4
Views: 7210
Reputation: 566
To find the resolution of multiple monitors, you can loop through the Screen.screens array and then get the bounding rectangle of each monitor screen. Typically AIR counts from left to right (0 index the right most monitor) but I haven't tested this on every monitor configuration.
import flash.display.Screen; for(var i:int = 0; i < Screen.screens.length; i++) { var x = Screen.screens[i].bounds.left; var y = 0; var width = Screen.screens[i].bounds.width; var height = Screen.screens[i].bounds.height; }
Upvotes: 3
Reputation: 8050
From http://www.sapethemape.com/2009/01/detecting-screen-resolution-in-flexair/, it looks like you can use Capabilities.screenResolutionX
and Capabilities.screenResolutionY
.
Example:
private function CapabilitiesMax():void
{
width = Capabilities.screenResolutionX;
height = Capabilities.screenResolutionY;
stage.nativeWindow.x = 0;
stage.nativeWindow.y = 0;
}
Upvotes: 7