Skip to Main Content
Adobe AIR 1.5 Cookbook
book

Adobe AIR 1.5 Cookbook

by Rich Tretola, David Tucker, Marco Casario, Koen DeWeggheleire, Koen De Weggheleire
November 2008
Beginner to intermediate content levelBeginner to intermediate
446 pages
10h 38m
English
O'Reilly Media, Inc.
Content preview from Adobe AIR 1.5 Cookbook

Chapter 4. Screens

Breaking out of the browser provides you with additional challenges when developing applications. In addition to positioning elements within your application, you now have control over where the application itself is positioned. In addition, you now have to expand your thinking beyond a browser window to a user’s desktop, which consists of one or more monitors.

The Screen class in Adobe AIR provides you with information about the current user’s monitor setup. This allows you to take advantage of the full capability of the user’s desktop, including multiple monitor configurations. By using the data contained in this class, you can get explicit information about the number of monitors, the positioning of these monitors, and even the capabilities of the monitors themselves.

Positioning Windows on the Desktop

Problem

You want to center your application on the user’s primary monitor.

Solution

Use the Screen class to determine the width and height of the primary monitor on the user’s computer. Using this information, you can position your application in the center of the screen.

Discussion

The Screen class has properties that reflect characteristics of the user’s primary monitor and provides an instance of itself in the static variable Screen.mainScreen. Included in these properties are two variables that define the width and height of the monitor: bounds and visibleBounds.

  • bounds: The bounds property of the Screen class is an instance of the Rectangle class, which provides ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Breaking Out of the Web Browser with Adobe AIR

Breaking Out of the Web Browser with Adobe AIR

Jeff Tapper, Michael Labriola, Peter Dilillo, Tom Kaczanko, Andriy Kupriyenko, Louie Penaflor, Mike Nimer, Nathan Weber, Steve Zimmers
Adobe AIR Programming Unleashed

Adobe AIR Programming Unleashed

Stacy Tyler Young, Michael Givens, Dimitrios Gianninas

Publisher Resources

ISBN: 9780596156145Supplemental ContentErrata Page