Packagecom.ghostwire.ui.containers
Classpublic class uiWindow
InheritanceuiWindow Inheritance uiComponent Inheritance flash.display.Sprite
SubclassesuiDialog

A uiWindow container contains a title bar and a content area for its child. It can also optionally display a menu bar and a status bar.

The container can be set to be closeable/maximizable/minimizable (by pressing respective buttons on the title bar), and/or resizable (by dragging edges of the window) by end-users. The window can also be set to be modal (while it is active, other parts of the application will not be interactive). The type of window created depends on the mode specified when the instance is created (this mode cannot be modified after instantiation).

To use uiWindow containers in your application, you must initialize the uiWindow class at the beginning of your application:

  // initialize the uiWindow class (just once)
  uiWindow.initialize(stage);

A uiWindow instance is created using the new operator as with any other DisplayObject, but you do not add it to the display list manually. To show a uiWindow instance, call its open() method:

  // creates a new normal window
  var win1:uiWindow = new uiWindow();
  win1.title = "Window 1 Title";
  
  // shows the window at stage coordinates 50,50
  win1.open(50,50);

  // creates a new window that can be closed but not resized
  var win2:uiWindow = new uiWindow(WINDOW.CAN_CLOSE);
  win2.title = "Window 2 Title";
  
  // shows the window at stage coordinates 50,100
  win2.open(50,100);

  // creates a new window that can be closed and resized but not minimized/maximized
  var win3:uiWindow = new uiWindow(WINDOW.CAN_CLOSE|WINDOW.CAN_RESIZE);
  win3.title = "Window 3 Title";
  
  // shows the window at the center of the stage
  win3.open();

Custom Cursors
If the com.ghostwire.ui.managers.uiCursors manager is initialized, the uiWindow class recognizes it and will take advantage of the feature automatically. Custom cursors are used when end-users resize the window by dragging the edges of the window. The assets used are:
SIZE_EW.png
SIZE_NESW.png
SIZE_NS.png
SIZE_NWSE.png
As of v1.2.0, preloading of the assets begins once uiWindow.initialize() is called.

~ This class is available in Aspire UI Components Standard Edition ~

See also

com.ghostwire.ui.containers.uiWindow.initialize()
com.ghostwire.ui.managers.uiCursors


Public Properties
 PropertyDefined by
 InheritedalignX : Number
Indicates how the component would like to be aligned horizontally within its allocated space.
uiComponent
 InheritedalignY : Number
Indicates how the component would like to be aligned vertically within its allocated space.
uiComponent
  alwaysOnTop : Boolean
Indicates if this uiWindow instance is always on top of other sibling uiWindow instances.
uiWindow
 Inheritedbackground : Object
Indicates the style of the background for this component.
uiComponent
 Inheritedcontainer : uiComponent
Indicates the uiComponent instance that contains this instance.
uiComponent
  content : uiForm
Returns the uiForm instance that is used as the content container.
uiWindow
  contentPadding : Object
Indicates the padding to apply to the content (uiForm child).
uiWindow
 Inheriteddepth : int
Indicates how deep the component is in the containment hierarchy.
uiComponent
 InheriteddesiredAllocationHeight : int
Indicates the vertical space this component would like to be allocated.
uiComponent
 InheriteddesiredAllocationWidth : int
Indicates the horizontal space this component would like to be allocated.
uiComponent
 Inheritedenabled : Boolean
Indicates whether the component is enabled for user interaction.
uiComponent
 InheritedfillX : Boolean
Indicates whether or not the component should automatically expand or shrink to fill its allocated horizontal space.
uiComponent
 InheritedfillY : Boolean
Indicates whether or not the component should automatically expand or shrink to fill its allocated vertical space.
uiComponent
 InheritedfocusPadding : Object
Indicates the thickness of the interior space from the edge of the component to the focus rectangle.
uiComponent
 InheritedfocusRect : Object
Indicates the class to use when rendering the rectangle around the component to indicate that it is in focus.
uiComponent
 Inheritedheight : Number
Indicates the current height of the component.
uiComponent
  icon : String
Indicates the source of the image to display in the title bar of this uiWindow instance.
uiWindow
  liveDragging : Boolean
Indicates whether the uiWindow instance should resize itself (and its contents) immediately when the end-user drags the edges of the window.
uiWindow
 Inheritedmargin : Object
Indicates the thickness of the space surrounding the component.
uiComponent
 InheritedmaxHeight : int
Indicates the upper limit for height.
uiComponent
  maximized : Boolean
Indicates whether this uiWindow instance is currently maximized.
uiWindow
 InheritedmaxWidth : int
Indicates the upper limit for width.
uiComponent
  menuModel : uiModel
Indicates the uiModel object to use to populate the menu bar of this uiWindow instance.
uiWindow
 InheritedminHeight : int
Indicates the lower limit for height.
uiComponent
  minimized : Boolean
Indicates whether this uiWindow instance is currently minimized/collapsed.
uiWindow
 InheritedminWidth : int
Indicates the lower limit for width.
uiComponent
  modalAlpha : Number
[static] Indicates the transparency level of the background when a modal window is displayed.
uiWindow
  modalColor : Number
[static] Indicates the color of the background when a modal window is displayed.
uiWindow
  mode : int
[read-only] Indicates whether the uiWindow instance is modal and/or can be closed, maximized, minimized or resized by end-users.
uiWindow
  owner : uiWindow
[read-only] Indicates the parent uiWindow instance.
uiWindow
 Inheritedpadding : Object
Indicates the thickness of the interior space from the edge of the component to the content area, which is where child components, if any, are contained.
uiComponent
 Inheritedskin : String
Indicates the name of the skin to use for this component instance.
uiComponent
  status : Object
Indicates the text to display in the status bar of this uiWindow instance.
uiWindow
 Inheritedstretch : Boolean
Indicates whether surplus space available in the parent container should be allocated to this component.
uiComponent
 InheritedtextStyle : String
Indicates the style to use for uiText instances contained in this component.
uiComponent
  title : String
Indicates the text to display in the title bar of this uiWindow instance.
uiWindow
 InheritedtoolTip : Object
Indicates the content (text) of the tooltip that should be shown when the mouse hovers over this control.
uiComponent
  uimenubar : uiMenuBar
[read-only] Returns the embedded uiMenuBar instance, if any - for advanced users only.
uiWindow
 Inheriteduiskin : uiBitmapImage
Returns the uiBitmapImage rendered as the skin - for advanced users only.
uiComponent
 Inheritedvisible : Boolean
Indicates whether or not the component is visible within its container.
uiComponent
 Inheritedwidth : Number
Indicates the current width of the component.
uiComponent
Public Methods
 MethodDefined by
  
uiWindow(mode:int, owner:uiWindow = null)
Constructor - creates a new uiWindow container instance.
uiWindow
  
close():Boolean
Closes this uiWindow instance (and its child windows if any).
uiWindow
  
getWindow(child:DisplayObject):uiWindow
[static] Returns a reference to the uiWindow container within which the specified child is contained.
uiWindow
  
initialize(stage:Stage):void
[static] Initializes the uiWindow class, registering the stage of the document (so that we know where to place the windows).
uiWindow
 Inherited
invalidate(type:String):void
Invalidates this component's "size", "display", "layout" or "textstyle".
uiComponent
 Inherited
move(x:Number, y:Number, noEvent:Boolean = false):void
Moves the component to the specified position, disregarding its allocation.
uiComponent
  
open(x:int = -1, y:int = -1):void
Opens this uiWindow instance, making it the current active window, giving it focus and bringing it to the front of its peer windows (if any).
uiWindow
 Inherited
removeAllChildren(all:Boolean = false):void
Removes all children from this component.
uiComponent
 Inherited
setFocus(flag:Boolean = true):void
Gives this component instance the focus; the component must be on the display list and has its tabEnabled property set to true, otherwise this method will fail silently.
uiComponent
 Inherited
setSize(width:Number, height:Number, noEvent:Boolean = false):void
Sets this component's size to the specified width and height.
uiComponent
 Inherited
setVisible(value:Boolean, noEvent:Boolean = false):void
Sets the visibility of this component instance, dispatching a "show" or "hide" event accordingly.
uiComponent
 Inherited
validateNow():void
Validates and render the component instance, and any component instances with depth higher than itself in the validation queue, immediately.
uiComponent
Events
 EventSummaryDefined by
   Dispatched when the uiWindow container is about to be closed.uiWindow
 Inherited Dispatched when the component's visible property is changed from true to false via calling the setVisible() method.uiComponent
   Dispatched when the end-user selects an enabled menu item from the menu bar.uiWindow
 Inherited Dispatched when the component's position within its parent container has changed via calling the move() method.uiComponent
   Dispatched when the uiWindow container is opened.uiWindow
 Inherited Dispatched when the component's size has changed via calling the setSize() method.uiComponent
 Inherited Dispatched when the component's visible property is changed from false to true via calling the setVisible() method.uiComponent
Property detail
alwaysOnTopproperty
alwaysOnTop:Boolean  [read-write]

Indicates if this uiWindow instance is always on top of other sibling uiWindow instances. uiWindow instances are siblings if they have the same owner.

If more than one sibling uiWindow instance has this property set to true, only the last opened instance will have this property honored.

Note: setting this property to true will not make the window appear on top of modal windows, which are always on top of all other windows on the stage.

Implementation
    public function get alwaysOnTop():Boolean
    public function set alwaysOnTop(value:Boolean):void
contentproperty 
content:uiForm  [read-write]

Returns the uiForm instance that is used as the content container. Note that this uiForm is the actual container, not the uiWindow itself. Therefore, all DisplayObjectContainer operations must be done via this content property.

You may also set this property to a uiForm instance of your choice thereby replacing the existing embedded instance.

Implementation
    public function get content():uiForm
    public function set content(value:uiForm):void

See also

contentPaddingproperty 
contentPadding:Object  [read-write]

Indicates the padding to apply to the content (uiForm child).

Implementation
    public function get contentPadding():Object
    public function set contentPadding(value:Object):void
iconproperty 
icon:String  [read-write]

Indicates the source of the image to display in the title bar of this uiWindow instance.

Implementation
    public function get icon():String
    public function set icon(value:String):void

See also

liveDraggingproperty 
public var liveDragging:Boolean

Indicates whether the uiWindow instance should resize itself (and its contents) immediately when the end-user drags the edges of the window. It is recommended that this property be left as false (default value) if the contents are complex.

The default value is false.

maximizedproperty 
maximized:Boolean  [read-write]

Indicates whether this uiWindow instance is currently maximized. When maximized, the instance fills the whole area of the stage.

The default value is false.

Implementation
    public function get maximized():Boolean
    public function set maximized(value:Boolean):void
menuModelproperty 
menuModel:uiModel  [read-write]

Indicates the uiModel object to use to populate the menu bar of this uiWindow instance.

By default, a uiWindow instance will not embed a menu bar unless this property is set.

Setting this property to null removes the menu (if one currently exists).

The default value is null.

Implementation
    public function get menuModel():uiModel
    public function set menuModel(value:uiModel):void

See also

minimizedproperty 
minimized:Boolean  [read-write]

Indicates whether this uiWindow instance is currently minimized/collapsed. When minimized, it is resized to a minimal size, and its contents and any child windows are hidden.

The default value is false.

Implementation
    public function get minimized():Boolean
    public function set minimized(value:Boolean):void
modalAlphaproperty 
public static var modalAlpha:Number

Indicates the transparency level of the background when a modal window is displayed. This value should be between 0.0 (totally transparent) and 1.0 (totally opaque).

modalColorproperty 
public static var modalColor:Number

Indicates the color of the background when a modal window is displayed. Applicable only if the modalAlpha property has a non-zero and non-NaN value.

modeproperty 
mode:int  [read-only]

Indicates whether the uiWindow instance is modal and/or can be closed, maximized, minimized or resized by end-users. This is a read-only property - the value must be specified when the uiWindow instance is created and stays the same throughout the life of the instance.

Note: regardless of the mode specified, the uiWindow instance will still be closeable/maximizable/minimizable/resizable programmatically.

Implementation
    public function get mode():int

See also

ownerproperty 
owner:uiWindow  [read-only]

Indicates the parent uiWindow instance.

Returns null if this uiWindow instance is a top-level window.

uiWindow instances with the same owner are referred to as peers or siblings.

Implementation
    public function get owner():uiWindow
statusproperty 
status:Object  [read-write]

Indicates the text to display in the status bar of this uiWindow instance.

Setting this property to null removes the status bar (if one currently exists). If you want to retain the status bar without showing any text, set this property to an empty string "".

The default value is null.

Implementation
    public function get status():Object
    public function set status(value:Object):void
titleproperty 
title:String  [read-write]

Indicates the text to display in the title bar of this uiWindow instance.

Implementation
    public function get title():String
    public function set title(value:String):void
uimenubarproperty 
uimenubar:uiMenuBar  [read-only]

Returns the embedded uiMenuBar instance, if any - for advanced users only. This property is exposed in case you would like greater control over the embedded uiMenuBar instance (that would be instantiated and embedded if the menuModel property is defined).

By default, a uiWindow instance will not embed a menu bar unless the menuModel property is set.

Implementation
    public function get uimenubar():uiMenuBar

See also

Constructor detail
uiWindow()constructor
public function uiWindow(mode:int, owner:uiWindow = null)

Constructor - creates a new uiWindow container instance.

Parameters
mode:int — Optional. An integer value indicating the mode of this uiWindow instance. The mode determines whether the uiWindow instance is modal and/or can be closed, minimized, maximized and/or resizeable by end-users. This value cannot be changed after the instance is created. The default value is WINDOW.NORMAL (which is equivalent to WINDOW.CAN_CLOSE|WINDOW.CAN_MAXIMIZE|WINDOW.CAN_MINIMIZE|WINDOW.CAN_RESIZE).
 
owner:uiWindow (default = null) — Optional. Indicates the uiWindow instance that owns this window. A uiWindow instance with an owner is created as a child window and appears on top of the parent window. If no owner is defined, this uiWindow instance is created as a top-level window.

See also

Method detail
close()method
public function close():Boolean

Closes this uiWindow instance (and its child windows if any).

Calling this method dispatches a Event.CLOSE event. If this event is cancelled by a listener, this method returns false. Otherwise, true is returned.

Returns
Boolean — A Boolean value indicating whether the window has closed.
getWindow()method 
public static function getWindow(child:DisplayObject):uiWindow

Returns a reference to the uiWindow container within which the specified child is contained. The uiWindow container need not be, and is unlikely to be, the direct parent of the specified child.

The method returns null if the child is not contained within a uiWindow container, not on the display list, or is itself a uiWindow.

This method is useful if you wish to know if a DisplayObject instance is contained within a uiWindow container, and if so, which one.

Parameters
child:DisplayObject — The DisplayObject to query.

Returns
uiWindow — A reference to the uiWindow containing the specified child. Returns null if the child is not contained within a uiWindow container, not on the display list, or is itself a uiWindow.
initialize()method 
public static function initialize(stage:Stage):void

Initializes the uiWindow class, registering the stage of the document (so that we know where to place the windows).

You must call this method once at the beginning of your application, otherwise no uiWindow instance can be shown.

Parameters
stage:Stage — A reference to the document Stage. Each Flash application has only one Stage object - the stage property of every display object on the display list refers to the same Stage object.
open()method 
public function open(x:int = -1, y:int = -1):void

Opens this uiWindow instance, making it the current active window, giving it focus and bringing it to the front of its peer windows (if any).

You can also use this method to activate a window that is already opened (making it the current active window, giving it focus and bringing it to the front of its peer windows).

Note that adding the window to the display list manually (via the addChild() method) will not work - you must call this method to show a window. When this method is called, the window is added to the display list automatically at the specified position (stage coordinates).

The static class method, uiWindow.initialize(), must be called at the beginning of your application, before this method is used (otherwise calling this method fails silently).

If you call this method without passing any parameter, the window will be positioned in the center of the stage.

Parameters
x:int (default = -1) — Optional. The horizontal position of the window. If this value is negative, the current x position of the instance is used.
 
y:int (default = -1) — Optional. The vertical position of the window. If this value is negative, the current y position of the instance is used.

See also

Event detail
closeevent 
Event object type: flash.events.Event

Dispatched when the uiWindow container is about to be closed.

This event has the following properties:

PropertyValue
bubblesfalse
cancelabletrue; if cancelled, the window will not close.
currentTargetThe object that is actively processing the event object with an event listener.
targetThe object that dispatched the event. The target is not always the object listening for the event. Use the currentTarget property to access the object that is listening for the event.
menuSelectevent  
Event object type: com.ghostwire.ui.events.uiMenuEvent
uiMenuEvent.type property = com.ghostwire.ui.events.uiMenuEvent.MENU_SELECT

Dispatched when the end-user selects an enabled menu item from the menu bar.

Dispatched when a user selects an enabled menu item from a uiMenu instance.

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. For example, if you use myMenuBar.addEventListener() to register an event listener, myMenuBar is the value of the currentTarget.
targetThe object that dispatched the event. The target is not always the object listening for the event. Use the currentTarget property to access the object that is listening for the event.
itemA data object representing the menu item selected.
menuThe uiMenu containing the menu item that has been selected.
openevent  
Event object type: flash.events.Event

Dispatched when the uiWindow container is opened.

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 that dispatched the event. The target is not always the object listening for the event. Use the currentTarget property to access the object that is listening for the event.