Is there a way to detect screen resolution in flex 4?

I want to create an application with an image that only bounces off the user's screen resolution. How can I go by detecting a user's screen resolution in flex 4? (If possible.)

+4
source share
2 answers

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; } 
+7
source

To find the resolution of several monitors, you can scroll the Screen.screens array, and then get the bounding box of each monitor screen. Normally, AIR counts from left to right (0 indexes the right monitor), but I have not tested this with 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;
 }
+3
source

Source: https://habr.com/ru/post/1342666/


All Articles