: Undefined index: mts_posttop_adcode in /home1/jccrosby/public_html/admin.crsby.com/wp-content/themes/playbook/single.php
on line 19
While working on a presentation about Native Windows & Adobe AIR I ran into the Screen class. The screen object provides information about the display screens available to an application allowing you to position applications/windows on different screens. I say screens and not monitors because of a little caveat that the livedocs have in them:
Note that there is not necessarily a one-to-one correspondance between screens and the physical monitors attached to a computer. For example, two monitors may display the same screen.
I thought I’d have a little fun to get my code fingers back after a week in Cabo San Lucas, and create a little AIR app that identifies each screen. The basics are:
- Identify the Screens – I knew I had 2 screens, so that was easy. The screens property is an array of Screen objects, so you can work with as many as the user has.
- Create something to identify the windows – I used transparent windows with a label to make things simple.
- Then position the new windows on the screens.
private var _screenOne:Screen;
private var _screenTwo:Screen;
private function _identScreens( p_event:MouseEvent ):void
// I know I have 2 screens so I’ll just grab those
_screenOne = Screen.screens;
_screenTwo = Screen.screens;
// Now lets identify the screens
var identOne:IdentWindow = new IdentWindow();
identOne.title = “Screen One”;
identOne.screenLabel = “1”;
// open the irst window and set its position on the first screen
identOne.open( true );
identOne.nativeWindow.x = ( _screenOne.bounds.width / 2 ) – ( identOne.width / 2 );
identOne.nativeWindow.y = ( _screenOne.bounds.height / 2 ) – ( identOne.height / 2 );
var identTwo:IdentWindow = new IdentWindow();
identTwo.title = “Screen Two”
identTwo.screenLabel = “2”;
// open the second window and set its position on the second screen
identTwo.open( true );
identTwo.nativeWindow.x = ( _screenTwo.bounds.right – ( _screenTwo.bounds.width / 2 ) ) – ( identTwo.width / 2 );
identTwo.nativeWindow.y = ( _screenTwo.bounds.bottom / 2 ) – ( identTwo.height / 2 );
Very straight forward and simple, but a fun little exercise.
You can download and install the app (with source) using the badge below:
[airbadge] Identify Screen Sample, http://www.thekuroko.com/wp-content/plugins/downloads-manager/upload/IdentifyScreens.air, 1.0, badge image.jpg[/airbadge]
Or, download the zip’ed flex archive:
: Undefined variable: defaults in /home1/jccrosby/public_html/admin.crsby.com/wp-content/themes/playbook/functions.php
on line 340
: Undefined index: mts_postend_adcode in /home1/jccrosby/public_html/admin.crsby.com/wp-content/themes/playbook/single.php
on line 28