capabilities.screenResolutionX Property | Flash 6 |
the width of the screen, in pixels | read/write |
The integer screenResolutionX property returns the total width, in pixels, of the screen on which the Flash Player is displayed. It is analogous to JavaScript's Screen.width property. You can use the screenResolutionX to center a browser pop-up window or inform the user when their resolution is too small to display a movie, as shown in the Example.
If we know the physical dimensions of a screen, we can use screenResolutionX and screenResolutionY in combination with screenDPI to calculate the actual size of an element in a movie. This is useful for scaling text to appear at the same size on all displays, as discussed under capabilities.screenDPI.
To retrieve the width of a movie's Stage rather than the whole screen or monitor, use Stage.width.
The corresponding server string for screenResolutionX is R, with a possible value that includes both the width and height of the screen, formatted as "WIDTHxHEIGHT" (for example, "1600x1200").
The following code displays a warning when the screen resolution is too small:
// Specify required resolution minResolutionX = 800; // If the requirement is not met... if (System.capabilities.screenResolutionX < minResolutionX) { // ...display a warning message this.createTextField("warning_txt", 1, 300, 300, 250, 30); this.warning_txt.border = true; this.warning_txt.text = "Movie requires an 800-pixel wide screen."; // Display a disabled frame this.gotoAndStop("movieDisabled"); }
In the first release of Macromedia's documentation for Flash MX, this property is incorrectly listed as System.capabilities.screenResolution.x. There should be no period before the final x, and the X should be capitalized.
capabilities.pixelAspectRatio, capabilities.screenDPI, capabilities.screenResolutionY, Stage.width