Getting the screen dimensions for Air Windows.
I want just to make it easier to get the screen dimensions found under the screen. I used the code found here: http://cookbooks.adobe.com/index.cfm?event=showdetails&postId=10823
So i just created a class that is static, and gives me the rectangle dimensions just when i need it and saving me writing the code..
package com.juandevelops.air.utils
{
import flash.display.NativeWindow;
import flash.display.NativeWindowInitOptions;
import flash.display.NativeWindowSystemChrome;
import flash.display.StageDisplayState;
import flash.events.EventDispatcher;
import flash.geom.Rectangle;
public class ScreenUtils
{
public static function getScreenRectangle():Rectangle
{
//set the window options before creating the window…
var options:NativeWindowInitOptions = new NativeWindowInitOptions()
options.systemChrome=NativeWindowSystemChrome.NONE;
options.transparent=true;
var tmpWindow:NativeWindow = new NativeWindow( options );
//blow up the window to take up the full size of the monitor…
tmpWindow.stage.displayState = StageDisplayState.FULL_SCREEN;
var rect:Rectangle = tmpWindow.bounds.clone();
//get rid of invisible window
tmpWindow.close();
return rect;
}
}
}
so it will be easier to use ScreenUtils.getScreenRectangle() anywhere else.