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.)
Asked
Active
Viewed 7,205 times
2 Answers
7
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;
}

Jason Towne
- 8,014
- 5
- 54
- 69
-
Yep. Npte that you will only get valeus from the main monitor. – Florian F Mar 07 '11 at 17:00
-
You can access other monitors resolution if you target AIR – Florian F Mar 07 '11 at 17:00
-
2For Mobile development: Mind that will report the computer screen resolution when using the device emulator, not the emulated device's screen resolution. – Francisc Aug 26 '11 at 22:52
3
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; }

Sam S
- 556
- 1
- 6
- 11