window.runtime propertywindow.runtime.flash.display.NativeWindow
InheritanceNativeWindow Inheritance EventDispatcher Inheritance Object
Runtime Versions: AIR 1.0

The NativeWindow class provides an interface for creating and controlling native desktop windows.

A reference to the NativeWindow instance is returned by the window constructor. JavaScript in an HTML page can reference the NativeWindow instance by using the window.nativeWindow property.

The properties of a NativeWindow instance can only be accessed by application content. If non-application content attempts to access the NativeWindow object, a security error will be thrown.

Content can be added to a window using the DisplayObjectContainer methods of the Stage object such as addChild().

To create a root HTML window for displaying HTML content it is typically easier to create the window with HTMLLoader.createRootContent(). Windows created in this way will have an HTMLLoader object added automatically. (From JavaScript code, you can also use the JavaScript window.open() function. However, this method gives you less control over the window appearance and behavior.)

The following operations on NativeWindow objects are asynchronous: close(), maximize(), minimize(), restore(), and bounds changes. An application can detect when these operations have completed by listening for the appropriate events.

If the NativeApplication.autoExit property is true, which is the default, the application will close when its last window is closed (and all close event handlers have returned). If autoExit is false, then NativeApplication.nativeApplication.exit() must be called to terminate the application.

NativeWindow objects will not be garbage collected after the window constructor has been called and before close() has been called. It is the responsibility of the application to close its own windows.

See also

Stage.nativeWindow
NativeWindowInitOptions
NativeApplication


Properties
 PropertyDefined By
  active : Boolean
[read-only] Indicates whether this window is the active application window.
NativeWindow
  alwaysInFront : Boolean
Specifies whether this window will always be in front of other windows (including those of other applications).
NativeWindow
  bounds : Rectangle
The size and location of this window.
NativeWindow
  closed : Boolean
[read-only] Indicates whether this window has been closed.
NativeWindow
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  displayState : String
[read-only] The display state of this window.
NativeWindow
  height : Number
The height of this window in pixels.
NativeWindow
  maximizable : Boolean
[read-only] Reports the maximizable setting used to create this window.
NativeWindow
  maxSize : Point
The maximum size for this window.
NativeWindow
  menu : NativeMenu
The native menu for this window.
NativeWindow
  minimizable : Boolean
[read-only] Reports the minimizable setting used to create this window.
NativeWindow
  minSize : Point
The minimum size for this window.
NativeWindow
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  resizable : Boolean
[read-only] Reports the resizable setting used to create this window.
NativeWindow
  stage : Stage
[read-only] The Stage object for this window.
NativeWindow
  supportsMenu : Boolean
[static] [read-only] Indicates whether AIR supports native window menus on the current computer system.
NativeWindow
  supportsNotification : Boolean
[static] [read-only] Indicates whether AIR supports window notification cueing on the current computer system.
NativeWindow
  supportsTransparency : Boolean
[static] [read-only] Indicates whether AIR supports native windows with transparent pixels.
NativeWindow
  systemChrome : String
[read-only] Reports the system chrome setting used to create this window.
NativeWindow
  systemMaxSize : Point
[static] [read-only] The largest window size allowed by the operating system.
NativeWindow
  systemMinSize : Point
[static] [read-only] The smallest window size allowed by the operating system.
NativeWindow
  title : String
The window title.
NativeWindow
  transparent : Boolean
[read-only] Reports the transparency setting used to create this window.
NativeWindow
  type : String
[read-only] Reports the window type setting used to create this window.
NativeWindow
  visible : Boolean
Specifies whether this window is visible.
NativeWindow
  width : Number
The width of this window in pixels.
NativeWindow
  x : Number
The horizontal axis coordinate of this window's top left corner relative to the origin of the operating system desktop.
NativeWindow
  y : Number
The vertical axis coordinate of this window's top left corner relative to the upper left corner of the operating system's desktop.
NativeWindow
Public Methods
 MethodDefined By
  
Creates a new NativeWindow instance and a corresponding operating system window.
NativeWindow
  
Activates this window.
NativeWindow
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
  
Closes this window.
NativeWindow
 Inherited
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
EventDispatcher
  
Converts a point in pixel coordinates relative to the origin of the window stage (a global point in terms of the display list), to a point on the virtual desktop.
NativeWindow
 Inherited
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
hasOwnProperty(name:String):Boolean
Indicates whether an object has a specified property defined.
Object
 Inherited
isPrototypeOf(theClass:Object):Boolean
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
Maximizes this window.
NativeWindow
  
Minimizes this window.
NativeWindow
  
notifyUser(type:String):void
Triggers a visual cue through the operating system that an event of interest has occurred.
NativeWindow
  
orderInBackOf(window:NativeWindow):Boolean
Sends this window directly behind the specified window.
NativeWindow
  
Brings this window directly in front of the specified window.
NativeWindow
  
orderToBack():Boolean
Sends this window behind any other visible windows.
NativeWindow
  
orderToFront():Boolean
Brings this window in front of any other visible windows.
NativeWindow
 Inherited
propertyIsEnumerable(name:String):Boolean
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
  
Restores this window from either a minimized or a maximized state.
NativeWindow
 Inherited
setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void
Sets the availability of a dynamic property for loop operations.
Object
  
startMove():Boolean
Starts a system-controlled move of this window.
NativeWindow
  
startResize(edgeOrCorner:String):Boolean
Starts a system-controlled resize operation of this window.
NativeWindow
 Inherited
toString():String
Returns the string representation of the specified object.
Object
 Inherited
valueOf():Object
Returns the primitive value of the specified object.
Object
 Inherited
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 Event Summary Defined By
  Dispatched by this NativeWindow object after the window has been activated.NativeWindow
  Dispatched by this NativeWindow object after the window has been closed.NativeWindow
  Dispatched by this NativeWindow object immediately before the window is to be closed.NativeWindow
  Dispatched by this NativeWindow object after the window has been deactivated.NativeWindow
  Dispatched by this NativeWindow object after the window's displayState property has changed.NativeWindow
  Dispatched by this NativeWindow object immediately before the window changes its display state.NativeWindow
  Dispatched by this NativeWindow object after the window has been moved on the desktop.NativeWindow
  Dispatched by the NativeWindow object immediately before the window is to be moved on the desktop.NativeWindow
  Dispatched by this NativeWindow object after the window has been resized.NativeWindow
  Dispatched by this NativeWindow object immediately before the window is to be resized on the desktop.NativeWindow
Property Detail
activeproperty
active:Boolean  [read-only]
Runtime Versions: AIR 1.0

Indicates whether this window is the active application window.

Use the activate() method to make a window active.

See also

alwaysInFrontproperty 
alwaysInFront:Boolean  [read-write]
Runtime Versions: AIR 1.0

Specifies whether this window will always be in front of other windows (including those of other applications).

There are two groups of windows in the system depth order. Windows in the alwaysInFront group are always displayed in front of all other windows. Depth ordering between windows within the same group is determined normally. In other words, activating a window will bring it in front of other windows in its group.

Changing alwaysInFront from false to true will bring the window to the top of all other windows. Changing the property from true to false will send the window to the back of "alwaysInFront" windows, but still in front of other windows. Setting the property to its current value will not change the window depth order.

The alwaysInFront property should rarely be set to true since windows with this setting will appear in front of the windows of other applications even when the other application is active.

Note: On Mac® OS X, setting alwaysInFront to true will have no effect when the displayState property of the window stage is fullScreen or fullScreenInteractive.


Example
Keep a window in front of other windows:
window.nativeWindow.alwaysInFront = true;
Keep a window in front of other windows:
window.nativeWindow.alwaysInFront = true;
boundsproperty 
bounds:Rectangle  [read-write]
Runtime Versions: AIR 1.0

The size and location of this window.

The dimensions of a window include any system chrome. The dimensions of a window's stage are equal to the dimensions of the window, minus the size of any system chrome. Changing the width and height of the window will change the stage's stageWidth and stageHeight. The reverse also applies; changing the stage dimensions will change the window size.

In a root HTML window, the outerWidth and outerHeigth properties are equivalent to the window height and width properties. The innerWidth and innerHeight properties equal the stage.stageWidth and stage.stageHeight properties minus the thickness of any automatic scrollbars displayed by the window.

A resize event is dispatched whenever the width or height of this window changes. Likewise, a move event is dispatched whenever the origin (x,y) of this window changes. Setting the bounds property directly will not dispatch a moving or resizing event. To allow other components to prepare for or cancel an impending move or resize operation, your bounds-changing logic can dispatch moving and resizing events with the NativeWindow dispatchEvent() method and then check whether the event was canceled by a registered listener.

Setting the bounds property of a window is equivalent to setting its x, y, width, and height properties. Likewise, setting any of the individual dimensions is equivalent to setting the bounds property. When you set all the dimensions at the same time by using the bounds property, fewer events are displatched.

If the width and the height specified are less than the minimum or greater than the maximum allowed size, because of the minSize and maxSize properties of the window or the minimum and maximum operating system limits, then the window dimensions are set to the closest legal size. The minimum width and height of any displayed system chrome may also result in a window that is larger than the specified size.


Throws
ArgumentError — If the rectangle is null or contains invalid values.
 
IllegalOperationError — If the bounds property is accessed after this window has been closed.

See also


Example
Set the location and size of the native desktop window:
window.nativeWindow.bounds = new air.Rectangle(20, 20, 800, 600);
Set the location and size of the native desktop window:
window.nativeWindow.bounds = new air.Rectangle(20, 20, 800, 600);
closedproperty 
closed:Boolean  [read-only]
Runtime Versions: AIR 1.0

Indicates whether this window has been closed.

Accessing the following properties on a closed window will throw an illegal operation error:

Likewise, calling the following methods on a closed window will also throw an illegal operation error:

displayStateproperty 
displayState:String  [read-only]
Runtime Versions: AIR 1.0

The display state of this window.

Constants for the possible values are defined in the NativeWindowDisplayState class:


Throws
IllegalOperationError — If the displayState property is accessed after this window has been closed.

See also

heightproperty 
height:Number  [read-write]
Runtime Versions: AIR 1.0

The height of this window in pixels.

The dimensions of a window include any system window chrome that is displayed. The height of the usable display area inside a window is available from the Stage.stageHeight property.

Changing the height property of a window is equivalent to changing the height through the bounds property.

If the height specified is less than the minimum or greater than the maximum allowed height, because of the minSize and maxSize properties of the window or the minimum and maximum operating system limits, then the window height is set to the closest legal size.


Throws
ArgumentError — If the value set is null or invalid.
 
IllegalOperationError — If the property is accessed after this window has been closed.

See also

maximizableproperty 
maximizable:Boolean  [read-only]
Runtime Versions: AIR 1.0

Reports the maximizable setting used to create this window.

The maximizable setting cannot be changed after a window is created.


Throws
SecurityError — When trying to set to false without sufficient privilege.
 
IllegalOperationError — If the property is accessed after this window has been closed.

See also

maxSizeproperty 
maxSize:Point  [read-write]
Runtime Versions: AIR 1.0

The maximum size for this window.

The size limit is specified as the coordinates of a Point object. The point x property corresponds to the window width, the y property to the window height.

The maxSize restriction is enforced for window resizing operations invoked both through JavaScript code and through the operating system.

Setting maxSize will change the window bounds if the current bounds are larger than the new maximum size.

Note: Maximizing a window will only enlarge the window to the maxSize value even if the maximized window will be smaller than the operating system screen. The window will still be in the maximized display state.


Throws
IllegalOperationError — If assigned size is not within the operating system minimum and maximum window sizes.
 
SecurityError — If size is forbidden for the content's current privilege.
 
ArgumentError — If the size is null or contains invalid values.
 
IllegalOperationError — If the maxSize property is accessed after this window has been closed.

See also


Example
Set the maximum window size:
window.nativeWindow.maxSize = new air.Point(960, 960);
Set the maximum window size:
window.nativeWindow.maxSize = new air.Point(960, 960);
menuproperty 
menu:NativeMenu  [read-write]
Runtime Versions: AIR 1.0

The native menu for this window.

When a NativeMenu object is assigned to the window menu property, a native menu will be displayed for a window if NativeWindow.supportsMenu is true, unless the window systemChrome property is NativeWindowSystemChrome.NONE.

Note: Assigning a menu to a window when NativeWindow.supportsMenu is false or when the window systemChrome property is NativeWindowSystemChrome.NONE is allowed, but does nothing.

See also

minimizableproperty 
minimizable:Boolean  [read-only]
Runtime Versions: AIR 1.0

Reports the minimizable setting used to create this window.

The minimizable setting cannot be changed after a window is created.


Throws
SecurityError — When trying to set to false without sufficient privilege.
 
IllegalOperationError — If the property is accessed after this window has been closed.

See also

minSizeproperty 
minSize:Point  [read-write]
Runtime Versions: AIR 1.0

The minimum size for this window.

The size limit is specified as the coordinates of a Point object. The point x property corresponds to the window width, the y property to the window height.

Setting minSize, will change the window bounds if the current bounds are smaller than the new minimum size.

The minSize restriction is enforced for window resizing operations invoked both through JavaScript code and through the operating system.

Note: The width and height of any displayed system chrome may make it impossible to set a window as small as the specified minimum size.


Throws
IllegalOperationError — If the assigned size is not within the operating system minimum and maximum window sizes.
 
SecurityError — If size is forbidden for the content's current privilege.
 
ArgumentError — If the size is null or contains invalid values.
 
IllegalOperationError — if the minSize property is accessed after this window has been closed. con

See also


Example
Set the minimum size for a window:
window.nativeWindow.minSize = new air.Point(80, 60);
Set the minimum size for a window:
window.nativeWindow.minSize = new air.Point(80, 60);
resizableproperty 
resizable:Boolean  [read-only]
Runtime Versions: AIR 1.0

Reports the resizable setting used to create this window.

The resizable setting cannot be changed after a window is created.


Throws
SecurityError — When trying to set to false without sufficient privilege.
 
IllegalOperationError — If the property is accessed after this window has been closed.

See also

stageproperty 
stage:Stage  [read-only]
Runtime Versions: AIR 1.0

The Stage object for this window.

The stage is the root of the display list for the window. Add visual display objects to a window by adding them to the stage or to another object already in the display list of this stage. The stage dimensions are those of the window client area when the window uses system chrome. The stage dimensions are equal to the dimensions of the window if system chrome is not used.

The HTMLLoader, which renders HTML content, is a single leaf in the display list tree. ActionScript-defined display objects can be both above and below the HTMLLoader in the drawing order, but not in between the visual elements rendered by the HTMLLoader.

See also

supportsMenuproperty 
supportsMenu:Boolean  [read-only]
Runtime Versions: AIR 1.0

Indicates whether AIR supports native window menus on the current computer system.

When NativeWindow.supportsMenu is true, a native menu will be displayed for a window when a NativeMenu object is assigned to the window menu property (unless the window systemChrome property is NativeWindowSystemChrome.NONE).

Note: Assigning a menu to a window when NativeWindow.supportsMenu is false or when the window systemChrome property is NativeWindowSystemChrome.NONE is allowed, but does nothing.

See also

supportsNotificationproperty 
supportsNotification:Boolean  [read-only]
Runtime Versions: AIR 1.0

Indicates whether AIR supports window notification cueing on the current computer system.

When NativeWindow.supportsNotification is true, calling the window's notify() method will result in a visual cue to the user that an event of interest has occurred. This visual cue will conform to the operating system convention of the native system. For example, on Windows®, the task bar icon will flash.

Note: Calling notify() when NativeWindow.supportsNotification is false is allowed, but does nothing.

See also

supportsTransparencyproperty 
supportsTransparency:Boolean  [read-only]
Runtime Versions: AIR 1.1

Indicates whether AIR supports native windows with transparent pixels.

When NativeWindow.supportsTransparency is true, transparency in pixels of a native window will be honored, if the window transparent property is set to true. Opacity of all pixels will be set to 1 if NativeWindow.supportsTransparency is false, regardless of the value of the window transparent property. Fully transparent pixels will render as black when NativeWindow.supportsTransparency is false.

Note: The value of this property might change while an appliction is running, based on user preferences.

See also

systemChromeproperty 
systemChrome:String  [read-only]
Runtime Versions: AIR 1.0

Reports the system chrome setting used to create this window.

The values returned by NativeWindow.systemChrome will be one of the constants defined in the NativeWindowSystemChrome class.

The system chrome setting cannot be changed after a window is created.


Throws
SecurityError — When trying to set to false without sufficient privilege.
 
IllegalOperationError — If the property is accessed after this window has been closed.

See also


Example
Check the type of system chrome used by a window:
var sysChromeType = window.nativeWindow.systemChrome;
Check the type of system chrome used by a window:
var sysChromeType = window.nativeWindow.systemChrome;
systemMaxSizeproperty 
systemMaxSize:Point  [read-only]
Runtime Versions: AIR 1.0

The largest window size allowed by the operating system.

The size limit is specified as the coordinates of a Point object. The point x property corresponds to the window width, the y property to the window height.

con

systemMinSizeproperty 
systemMinSize:Point  [read-only]
Runtime Versions: AIR 1.0

The smallest window size allowed by the operating system.

The size limit is specified as the coordinates of a Point object. The point x property corresponds to the window width, the y property to the window height.

con

titleproperty 
title:String  [read-write]
Runtime Versions: AIR 1.0

The window title.

The title will appear in the system chrome for the window, if displayed, as well as in other system-dependent locations (such as the task bar).


Throws
IllegalOperationError — If the property is accessed after this window has been closed.
transparentproperty 
transparent:Boolean  [read-only]
Runtime Versions: AIR 1.0

Reports the transparency setting used to create this window.

The transparent property cannot be changed after a window is created. Transparency affects both the visual appearance and the mouse behavior of the window. If the alpha value of a pixel is below a certain threshold, which varies between about .06 and .01 depending on the operating system, then the window will not capture mouse events above that pixel.


Throws
SecurityError — When trying to set to false without sufficient privilege.
 
IllegalOperationError — If the property is accessed after this window has been closed.

See also

typeproperty 
type:String  [read-only]
Runtime Versions: AIR 1.0

Reports the window type setting used to create this window.

The values returned by NativeWindow.type will be one of the constants defined in the NativeWindowType class.

The type setting cannot be changed after a window is created.


Throws
SecurityError — When trying to set to false without sufficient privilege.
 
IllegalOperationError — If the property is accessed after this window has been closed.

See also

visibleproperty 
visible:Boolean  [read-write]
Runtime Versions: AIR 1.0

Specifies whether this window is visible.

An invisible window is not displayed on the desktop, but all window properties and methods are valid.

By default, visible is set to false. To display a window, set visible to true or call NativeWindow.activate().

Note: On Mac OS X, setting visible=false on a minimized window will not remove the window icon from the dock. If a user subsequently clicks the dock icon, the window will return to the visible state and be displayed on the desktop.


Throws
SecurityError — When trying to set to false without sufficient privilege.
 
IllegalOperationError — If the property is accessed after this window has been closed.

See also


Example
Make a window visible:
window.nativeWindow.visible = true;
Make a window visible:
window.nativeWindow.visible = true;
widthproperty 
width:Number  [read-write]
Runtime Versions: AIR 1.0

The width of this window in pixels.

The dimensions reported for a native window include any system window chrome that is displayed. The width of the usable display area inside a window is available from the Stage.stageWidth property.

Changing the width property of a window is equivalent to changing the width through the bounds property.

If the width specified is less than the minimum or greater than the maximum allowed width, because of the minSize and maxSize properties of the window, or the minimum and maximum operating system limits, then the window width is set to the closest legal size.


Throws
ArgumentError — If the value set is null or invalid.
 
IllegalOperationError — If the property is accessed after this window has been closed.

See also

xproperty 
x:Number  [read-write]
Runtime Versions: AIR 1.0

The horizontal axis coordinate of this window's top left corner relative to the origin of the operating system desktop.

On systems with more than one monitor, x can be negative. If you save the value, perhaps to reposition a window at its previous location, you should always verify that the window is placed in a usable location when the position is restored. Changes in screen resolution or monitor arrangement can can result in a window being placed off screen. Use the Screen class to obtain information about the desktop geometry.

Changing the x property of a window is equivalent to changing the location through the bounds property.


Throws
ArgumentError — If the value set is null or invalid.
 
IllegalOperationError — If the property is accessed after this window has been closed.

See also

yproperty 
y:Number  [read-write]
Runtime Versions: AIR 1.0

The vertical axis coordinate of this window's top left corner relative to the upper left corner of the operating system's desktop.

On systems with more than one monitor, y can be negative. If you save the value, perhaps to reposition a window at its previous location, you should always verify that the window is placed in a usable location when the position is restored. Changes in screen resolution or monitor arrangement can can result in a window being placed off screen. Use the Screen class to obtain information about the desktop geometry.

Changing the y property of a window is equivalent to changing the location through the bounds property.


Throws
ArgumentError — If the value set is null or invalid.
 
IllegalOperationError — If the property is accessed after this window has been closed.

See also

Constructor Detail
NativeWindow()Constructor
function NativeWindow(initOptions:NativeWindowInitOptions)
Runtime Versions: AIR 1.0

Creates a new NativeWindow instance and a corresponding operating system window.

The settings defined in the initOptions parameter cannot be changed after the window is created. Invalid initOptions settings will cause an illegal operation error to be thrown. Settings that are valid but not available on the current system will not throw an exception. The window capabilities specific to the current operating system can be detected, if desired, using the static NativeWindow members such as systemMaxSize.

The default window size is determined by the operating system, but can be changed by setting the window bounds. The change will not be visible if the window visible property is false.

Parameters
initOptions:NativeWindowInitOptions — An object containing the initialization properties for this window.

Throws
IllegalOperationError — If the initOptions parameter is invalid.

See also

Method Detail
activate()method
function activate():void
Runtime Versions: AIR 1.0

Activates this window.

Activating a window will:

See also


Example



Activate a window:
window.nativeWindow.activate();
close()method 
function close():void
Runtime Versions: AIR 1.0

Closes this window.

A close event is dispatched as soon as the close operation is complete. A closing event will not be dispatched. If cancellation of the close operation should be allowed, dispatch a closing event and check whether any registered listeners cancel the default behavior before calling the close() method.

If display object instances that are currently in the window are not referenced elsewhere they will be garbage collected and destroyed, except on the initial application window created by AIR. To allow display objects on the initial window to be garbage collected, remove them from the window stage.

After being closed, the NativeWindow object is still a valid reference, but accessing most properties and methods will throw an illegal operation error.

Closed windows cannot be reopened. If the window is already closed, no action is taken and no events are dispatched.

Note: to hide a window without closing it, set the window's visible property to false.

See also


Example



Close a window:
window.close();

Or:
window.nativeWindow.close();


The following example illustrates how to close a window from a while allowing the operation to be canceled:
<script src="AIRAliases.js" type="text/javascript"></script>
<script type="text/javascript">
    var dirtyData = false;
    function closeWindow(){
            var closingEvent = new air.Event(air.Event.CLOSING,true,true);
            window.nativeWindow.dispatchEvent(closingEvent);
               if(!closingEvent.isDefaultPrevented()){
                   window.nativeWindow.close();
                //or use: window.close(); 
               return true;
           } else {
               return false;
        }
    }
        
    function onClosing(event){
        if(dirtyData){
            event.preventDefault();
            //Save data...
        }
    }    

    window.nativeWindow.addEventListener(air.Event.CLOSING,onClosing);        
</script>
globalToScreen()method 
function globalToScreen(globalPoint:Point):Point
Runtime Versions: AIR 1.0

Converts a point in pixel coordinates relative to the origin of the window stage (a global point in terms of the display list), to a point on the virtual desktop.

Virtual desktop coordinates are relative to the upper, lefthand corner of the primary monitor.

Parameters

globalPoint:Point — The point on the stage to convert to a point on the screen.

Returns
Point — The specified global point relative to the desktop.

See also

maximize()method 
function maximize():void
Runtime Versions: AIR 1.0

Maximizes this window.

Calling maximize() method dispatches a displayStateChange event, and, if applicable, a move and a resize event. Whereas system chrome will dispatch a displayStateChanging event that can be canceled when a maximize command is initiated by a user, your maximize logic must implement this behavior, if desired.

The maximize() method executes asynchronously. To detect the completion of the state change, listen for the displayStateChange event.

If the window is already maximized, no action is taken and no events are dispatched.

Note: On operating systems, such as Mac OS X, in which maximizing a window does not also prevent resizing, calling maximize() will zoom the window to fill the screen, but will not prevent subsequent resizing of the window. Resizing a zoomed window will also restore the display state.


Throws
IllegalOperationError — If the maximizable property of this window is false or if the method is called after this window has been closed.

See also


Example


The following example illustrates how to allow cancelation of a maximize operation:
function maximizeWindow(){
    if(window.nativeWindow.displayState != air.NativeWindowDisplayState.MAXIMIZED){
        var beforeState = window.nativeWindow.displayState;
        var afterState = air.NativeWindowDisplayState.MAXIMIZED;
        var displayStateEvent = 
            new air.NativeWindowDisplayStateEvent(air.NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,
                                              true,true,beforeState,afterState);
        nativeWin.dispatchEvent(displayStateEvent);
        if(!displayStateEvent.isDefaultPrevented()){
            window.nativeWindow.maximize();
            return true;
        } else {
          return false;
        }
     }
     return false;
}
minimize()method 
function minimize():void
Runtime Versions: AIR 1.0

Minimizes this window.

Calling minimize() dispatches a displayStateChange event, and, if applicable, a move and a resize event. Whereas system chrome will dispatch a displayStateChanging event that can be canceled when a minimize command is initiated by a user, calling minimize() directly does not. Your minimize logic may implement this behavior, if desired.

The minimize() method executes asynchronously. To detect the completion of the state change, listen for the displayStateChange event.

If the window is already minimized, no action is taken and no events are dispatched.


Throws
IllegalOperationError — If the minimizable property of this window is false or if the method is called after this window has been closed.

See also


Example


The following example illustrates how to allow cancelation of a call to minimize():
 
function minimizeWindow(){
    if(window.nativeWindow.displayState != air.NativeWindowDisplayState.MINIMIZED){
        var beforeState = window.nativeWindow.displayState;
        var afterState = air.NativeWindowDisplayState.MINIMIZED;
        var displayStateEvent = 
            new air.NativeWindowDisplayStateEvent(air.NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,
                                              true,true,beforeState,afterState);
        window.nativeWindow.dispatchEvent(displayStateEvent);
        if(!displayStateEvent.isDefaultPrevented()){
            window.nativeWindow.minimize();
            return true;
        } else {
          return false;
        }
     }
     return false;
}
notifyUser()method 
function notifyUser(type:String):void
Runtime Versions: AIR 1.0

Triggers a visual cue through the operating system that an event of interest has occurred.

When NativeWindow.supportsNotification is true, the visual cue will conform to the operating system convention of the native system. For example, on Windows, the task bar icon will flash.

The type parameter determines the intensity of the cue. Constants for the permitted values are defined in the NotificationType class, and may be:

The cues provided for informational notifications are of short duration; those provided for critical notifications will last until the user activates this window.

Note: Calling notifyUser() when NativeWindow.supportsNotification is false is allowed, but does nothing.

Parameters

type:String — A string representing the urgency of the notification.

orderInBackOf()method 
function orderInBackOf(window:NativeWindow):Boolean
Runtime Versions: AIR 1.0

Sends this window directly behind the specified window.

Does not activate or acquire the focus for the window or the application. Minimized or hidden (visible is false) windows cannot be reordered.

Parameters

window:NativeWindow — An application window.

Returns
Booleantrue if this window was succesfully sent to the back; false if this window is invisible or minimized.

Example



Order one window behind another using references to two JavaScript Window objects:
jsWindowObjBehind.nativeWindow.orderInBackOf(jsWindowObjFront.nativeWindow);
orderInFrontOf()method 
function orderInFrontOf(window:NativeWindow):Boolean
Runtime Versions: AIR 1.0

Brings this window directly in front of the specified window.

Does not activate or acquire the focus for the window or the application. Minimized or hidden (visible is false) windows cannot be reordered.

Parameters

window:NativeWindow — An application window.

Returns
Booleantrue if this window was succesfully brought to the front; false if this window is invisible or minimized.

Example



Order one window in front of another using references to two JavaScript window objects:
jsWindowObjFront.nativeWindow.orderInFrontOf(jsWindowObjBehind.nativeWindow);

orderToBack()method 
function orderToBack():Boolean
Runtime Versions: AIR 1.0

Sends this window behind any other visible windows.

Does not activate or acquire the focus for this window or the application. Minimized or hidden (visible is false) windows cannot be reordered.

If alwaysInFront is true, then calling this method will not send this window behind any windows which have alwaysInFront set to false.

Returns
Booleantrue if this window was succesfully sent to the back; false if this window is invisible or minimized.

Example



Put a window at the bottom of the display order:
window.nativeWindow.orderToBack();

orderToFront()method 
function orderToFront():Boolean
Runtime Versions: AIR 1.0

Brings this window in front of any other visible windows.

Does not activate or acquire the focus for this window or the application. Minimized or hidden (visible is false) windows cannot be reordered.

If alwaysInFront is false, then calling this method will not send this window in front of any windows which have alwaysInFront set to true.

Returns
Booleantrue if this window was succesfully brought to the front; false if this window is invisible or minimized.

Example



Bring a window to the front of the display order:
window.nativeWindow.orderToFront();

restore()method 
function restore():void
Runtime Versions: AIR 1.0

Restores this window from either a minimized or a maximized state.

Calling restore() dispatches a displayStateChange event, and, if applicable, a move and a resize event. Whereas system chrome will dispatch a displayStateChanging event that can be canceled when a restore command is initiated by a user, your restore logic must implement this behavior, if desired.

The restore() method executes asynchronously. To detect the completion of the state change, listen for the displayStateChange event.

If the window is already in the NativeWindowDisplayState.NORMAL state, no action is taken and no events are dispatched.


Throws
IllegalOperationError — If the method is called after this window has been closed.

See also


Example


The following example illustrates how to allow cancelation of a restore operation:
function restoreWindow(){
    if(window.nativeWindow.displayState != air.NativeWindowDisplayState.NORMAL){
        var beforeState = window.nativeWindow.displayState;
        var afterState = air.NativeWindowDisplayState.NORMAL;
        var displayStateEvent = 
            new air.NativeWindowDisplayStateEvent(air.NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,
                                              true,true,beforeState,afterState);
        window.nativeWindow.dispatchEvent(displayStateEvent);
        if(!displayStateEvent.isDefaultPrevented()){
            window.nativeWindow.restore();
            return true;
        } else {
          return false;
        }
     }
     return false;
}
startMove()method 
function startMove():Boolean
Runtime Versions: AIR 1.0

Starts a system-controlled move of this window.

When called from a mouseDown event, this method begins a mouse-driven move sequence that continues until a mouseUp event occurs.

When called from other code this method begins a keyboard- or mouse-driven move sequence consistent with the operating system's default sequence.

During a move sequence, a series of events will be dispatched as the window origin moves. For each incremental move, first a moving event is dispatched and then, if the moving event is not canceled, the window location is updated and a move event is dispatched. If a moving event is canceled, the move sequence is immediately terminated.

Returns
Booleantrue if the move was succesfully initiated and false if the window is maximized.

Throws
IllegalOperationError — If the method is called after this window has been closed.
startResize()method 
function startResize(edgeOrCorner:String):Boolean
Runtime Versions: AIR 1.0

Starts a system-controlled resize operation of this window.

When called from a mouseDown event handler this method begins a mouse-driven resizing sequence that continues until a mouseUp event occurs.

When called from other code this method begins a keyboard- or mouse-driven resizing sequence consistent with the operating system's default sequence.

During the resize sequence, a series of events will be dispatched as the window dimensions change. For each incremental change, first a resizing event is dispatched and then, if the resizing event is not canceled, the window dimensions are updated and a resize event is dispatched. If a resizing event is canceled, the the sequence is immediately terminated.

Parameters

edgeOrCorner:String (default = NaN) — A constant from the NativeWindowResize class that specifies which edge or corner of this window to resize. The following are valid values:

ValueVertical alignmentHorizontal alignment
NativeWindowResize.TOPTopCenter
NativeWindowResize.BOTTOMBottomCenter
NativeWindowResize.LEFTCenterLeft
NativeWindowResize.RIGHTCenterRight
NativeWindowResize.TOP_LEFTTopLeft
NativeWindowResize.TOP_RIGHTTopRight
NativeWindowResize.BOTTOM_LEFTBottomLeft
NativeWindowResize.BOTTOM_RIGHTBottomRight
NativeWindowResize.NONEBottomRight

Returns
Booleantrue if the resize was succesfully initiated and false if the window is maximized.

Throws
IllegalOperationError — If the method is called after this window has been closed.
Event Detail
activate Event
Event Object Type: flash.events.Event
property Event.type = flash.events.Event.ACTIVATE
Runtime Versions: AIR 1.0

Dispatched by this NativeWindow object after the window has been activated.

The Event.ACTIVATE constant defines the value of the type property of an activate event object.

Note: This event does not go through a "capture phase" and is dispatched directly to the target, whether the target is on the display list or not.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetAny DisplayObject instance with a listener registered for the ACTIVATE event.
close Event  
Event Object Type: flash.events.Event
property Event.type = flash.events.Event.CLOSE
Runtime Versions: AIR 1.0

Dispatched by this NativeWindow object after the window has been closed.

The Event.CLOSE constant defines the value of the type property of a close event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe object whose connection has been closed.
closing Event  
Event Object Type: flash.events.Event
property Event.type = flash.events.Event.CLOSING
Runtime Versions: AIR 1.0

Dispatched by this NativeWindow object immediately before the window is to be closed. This event can be canceled to prevent the window from being closed.

The Event.CLOSING constant defines the value of the type property of a closing event object.

This event has the following properties:

PropertyValue
bubblesfalse
cancelabletrue; canceling this event object stops the close operation.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe object whose connection is to be closed.
deactivate Event  
Event Object Type: flash.events.Event
property Event.type = flash.events.Event.DEACTIVATE
Runtime Versions: AIR 1.0

Dispatched by this NativeWindow object after the window has been deactivated.

The Event.DEACTIVATE constant defines the value of the type property of a deactivate event object.

Note: This event does not go through a "capture phase" and is dispatched directly to the target, whether the target is on the display list or not.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetAny DisplayObject instance with a listener registered for the DEACTIVATE event.
displayStateChange Event  
Event Object Type: flash.events.NativeWindowDisplayStateEvent
property NativeWindowDisplayStateEvent.type = flash.events.NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGE
Runtime Versions: AIR 1.0

Dispatched by this NativeWindow object after the window's displayState property has changed.

Defines the value of the type property of a displayStateChange event object. This event has the following properties:
PropertiesValues
afterDisplayStateThe old display state of the window.
beforeDisplayStateThe new display state of the window.
targetThe NativeWindow instance that has just changed state.
bubblesNo.
currentTargetIndicates the object that is actively processing the Event object with an event listener.
cancelablefalse; There is no default behavior to cancel.
displayStateChanging Event  
Event Object Type: flash.events.NativeWindowDisplayStateEvent
property NativeWindowDisplayStateEvent.type = flash.events.NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING
Runtime Versions: AIR 1.0

Dispatched by this NativeWindow object immediately before the window changes its display state. This event can be canceled to prevent the change.

Defines the value of the type property of a displayStateChanging event object. This event has the following properties:
PropertiesValues
afterDisplayStateThe display state of the window before the pending change.
beforeDisplayStateThe display state of the window after the pending change.
targetThe NativeWindow instance that has just changed state.
bubblesNo.
currentTargetIndicates the object that is actively processing the Event object with an event listener.
cancelabletrue; canceling the event will prevent the change.
move Event  
Event Object Type: flash.events.NativeWindowBoundsEvent
property NativeWindowBoundsEvent.type = flash.events.NativeWindowBoundsEvent.MOVE
Runtime Versions: AIR 1.0

Dispatched by this NativeWindow object after the window has been moved on the desktop.

A move event is dispatched whenever the origin (x or y properties) of the window changes, which can occur because of a system-controlled window move; minimizing, maximizing, or restoring the window; or changing the window location by setting the x, y, or bounds properties.

Note: Avoid actions that may open simultaneous operating system dialogs boxes in the handler functions for both the moving and move events of a NativeWindow object. This may occur, for example, if both handler functions throw an error. If it does occur, the second dialog box opened will not register mouse clicks and must be closed using the keyboard.

Defines the value of the type property of a move event object. This event has the following properties:
PropertiesValues
afterBoundsThe new bounds of the window.
beforeBoundsThe old bounds of the window.
targetThe NativeWindow object that has just changed state.
bubblesNo.
currentTargetIndicates the object that is actively processing the Event object with an event listener.
cancelablefalse; There is no default behavior to cancel.
moving Event  
Event Object Type: flash.events.NativeWindowBoundsEvent
property NativeWindowBoundsEvent.type = flash.events.NativeWindowBoundsEvent.MOVING
Runtime Versions: AIR 1.0

Dispatched by the NativeWindow object immediately before the window is to be moved on the desktop. This event can be canceled to prevent or modify the move.

Note: Avoid actions that may open simultaneous operating system dialogs boxes in the handler functions for both the moving and move events of a NativeWindow object. This may occur, for example, if both handler functions throw an error. If it does occur, the second dialog box opened will not register mouse clicks and must be closed using the keyboard.

Defines the value of the type property of a moving event object. This event has the following properties:
PropertiesValues
afterBoundsThe bounds of the window after the pending change.
beforeBoundsThe bounds of the window before the pending change.
bubblesNo.
cancelabletrue; cancelling the event will prevent the window move.
currentTargetIndicates the object that is actively processing the Event object with an event listener.
targetThe NativeWindow object that has just changed state.
resize Event  
Event Object Type: flash.events.NativeWindowBoundsEvent
property NativeWindowBoundsEvent.type = flash.events.NativeWindowBoundsEvent.RESIZE
Runtime Versions: AIR 1.0

Dispatched by this NativeWindow object after the window has been resized. A resize event is dispatched whenever the size (width or height properties) of the window changes, which can occur because of a system-controlled window resize; minimizing, maximizing, or restoring the window; or changing the window size by setting the width, height, or bounds properties. NativeWindow resize events are dispatched during system-controled resize loops. In contrast, Stage object resize events are dispatched when the Stage is ready for drawing.

Defines the value of the type property of a resize event object. This event has the following properties:
PropertiesValues
afterBoundsThe new bounds of the window.
beforeBoundsThe old bounds of the window.
targetThe NativeWindow object that has just changed state.
bubblesNo.
currentTargetIndicates the object that is actively processing the Event object with an event listener.
cancelablefalse; There is no default behavior to cancel.

See also

resizing Event  
Event Object Type: flash.events.NativeWindowBoundsEvent
property NativeWindowBoundsEvent.type = flash.events.NativeWindowBoundsEvent.RESIZING
Runtime Versions: AIR 1.0

Dispatched by this NativeWindow object immediately before the window is to be resized on the desktop. This event can be canceled to prevent or modify the resize.

Defines the value of the type property of a resizing event object. This event has the following properties:
PropertiesValues
afterBoundsThe bounds of the window after the pending change.
beforeBoundsThe bounds of the window before the pending change.
targetThe NativeWindow object that has just changed state.
bubblesNo.
currentTargetIndicates the object that is actively processing the Event object with an event listener.
cancelabletrue; cancelling the event will prevent the window move.