Identifying Multiple Screens with Adobe AIR

Wednesday, May 7th, 2008

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:

  1. 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.
  2. Create something to identify the windows - I used transparent windows with a label to make things simple.
  3. Then position the new windows on the screens.
Actionscript:
  1. private var _screenOne:Screen;
  2.     private var _screenTwo:Screen;
  3.  
  4.     private function _identScreens( p_event:MouseEvent ):void
  5.     {
  6.         // I know I have 2 screens so I'll just grab those
  7.         _screenOne = Screen.screens[0];
  8.         _screenTwo = Screen.screens[1];
  9.  
  10.         // Now lets identify the screens
  11.         var identOne:IdentWindow = new IdentWindow();
  12.         identOne.title = "Screen One";
  13.         identOne.screenLabel = "1";
  14.  
  15.         // open the irst window and set its position on the first screen
  16.         identOne.open( true );
  17.         identOne.nativeWindow.x = ( _screenOne.bounds.width / 2 ) - ( identOne.width / 2 );
  18.         identOne.nativeWindow.y = ( _screenOne.bounds.height / 2 ) - ( identOne.height / 2 );
  19.  
  20.         var identTwo:IdentWindow = new IdentWindow();
  21.         identTwo.title = "Screen Two"
  22.         identTwo.screenLabel = "2";
  23.  
  24.         // open the second window and set its position on the second screen
  25.         identTwo.open( true );
  26.         identTwo.nativeWindow.x = ( _screenTwo.bounds.right - (  _screenTwo.bounds.width / 2 ) ) - ( identTwo.width / 2 );
  27.         identTwo.nativeWindow.y = ( _screenTwo.bounds.bottom / 2 ) - ( identTwo.height / 2 );
  28. }

Very straight forward and simple, but a fun little exercise.

You can download and install the app (with source) using the badge below:

Please upgrade your Flash Player This is the content that would be shown if the user does not have Flash Player 9.0.115 or higher installed.

Or, download the zip'ed flex archive:

http://john.realeyes.com/wp-content/plugins/downloads-manager/img/icons/winzip.gif download: Identify Screen Sample (4.59KB)
added: 07/05/2008
clicks: 40
description:

Adobe Announces the Open Screen Project

Wednesday, April 30th, 2008

Adobe has just announced the Open Screen Project.

The Skinny:

  • Restrictions on use of the SWF and FLV/F4V specifications will be removed
  • The device porting layer APIs for Adobe Flash Player will be published
  • The Adobe Flash® Cast™ protocol and the AMF protocol for robust data services will be published
  • Licensing fees will be removed – making next major releases of Adobe Flash Player and Adobe AIR for devices free

What does it really mean? Well it could be the promise of a universal application platform and the ability to write an application and deploy it everywhere. But, we know, with the likes of Apple and Google, who haven't really taken to the flash platform, that probably isn't the case. To me it means that Adobe is allowing the community as a whole to participate in the direction that the flash platform takes. To develop what what the community wants and thinks needs to be developed. This is a good thing - yay Adobe and yay Flash!

A few more links to read:

Ryan Stewart

Techcrunch

Wired

Developers: http://www.adobe.com/openscreenproject/developers/

Businesses: http://www.adobe.com/openscreenproject/businesses/

Beatport Downloader 1.0 officially launched!

Friday, April 25th, 2008

The Beatport Downloader launched officially on April 22nd. This is an application that the team here at Realeyes built. The official downloader description follows:

The Beatport Downloader allows you to download and organize your recently purchased tracks with one click. No more incomplete or lost music, easily see the status of all your downloads. Organize your music like never before through the Downloader's folder naming preferences. This feature allows for full control of how you store and search your music library. Install the application by clicking the Install button to the right. If you do not have Adobe® AIR™, it will ask you to install that first. Learn more about Adobe® AIR™ below.

About Beatport:

Beatport is the first authentic digital music store designed to service the evolution of the digital music culture, redefining how DJs and enthusiasts acquire their music. Beatport.com allows users to access the world of club music through secure, legal, hi-speed, high quality downloads in MP3, MP4 and WAV formats on a pay per download basis. With hundreds of labels and thousands of users world wide, Beatport is recognized as the leader for online, electronic dance music.

So, if you're interested, check out the downloader at www.beatportdownloader.com.

Find entries :

Want to subscribe?

  Subscribe in a reader or,
Subscribe via email:

About me

I'm a senior developer at RealEyes Media, Adobe Certified Instructor and Adobe Certified Professional. Here you'll get my ideas and experience Flex, Flash, ColdFusion and related technologies as well as some generally off the wall stuff.