Packagecom.joebillman.containers
Classpublic class Window
InheritanceWindow Inheritance flash.display.Sprite

Window: Creates a window that can be used as a pop-in or a content window.

View the examples



Public Properties
 PropertyDefined By
  autoMask : Boolean
Gets or sets the autoMask value
Window
  blurAmount : Number
Gets or sets the blur amount
Window
  btmCurve : Number
Gets or sets the amount of curve on the bottom corners
Window
  btnColor : uint
Gets or sets the color of the close button
Window
  btnOverColor : uint
Gets or sets the color of the close button over glow
Window
  btnSymbolColor : uint
Gets or sets the color of the 'X' symbol in the close button
Window
  closeOnX : Boolean
Gets or sets whether the window closes automatically when the X button is pressed
Window
  color : uint
Gets or sets the color value of the window
Window
  colorAlpha : Number
Gets or sets the alpha value of the window
Window
  content : DisplayObject
Gets or sets a reference to the content for the window
Window
  contentBGAlpha : Number
Gets or sets the alpha of the inset content area for the window
Window
  contentBGColor : uint
Gets or sets the color of the content area for the window
Window
  contentHeight : Number
Gets or sets the value of the content height of the window
Window
  contentWidth : Number
Gets or sets the value of the content width of the window
Window
  contentX : Number
Gets or sets the value of the content starting x position
Window
  contentY : Number
Gets or sets the value of the content starting y position
Window
  curParent : DisplayObjectContainer
Gets or sets a reference to the parent value of the window
Window
  destroyOnFade : Boolean
Gets or sets a reference to the destroyOnFade value
Window
  fadeInOnBuild : Boolean
Gets or sets whether to fade in or not when buildWindow is called
Window
  fadeInTime : Number
Gets or sets the time in seconds for the fade in
Window
  fadeOutOnDestroy : Boolean
Gets or sets whether to fade out or not when destroyWindow is called
Window
  fadeOutTime : Number
Gets or sets the time in seconds for the fade out
Window
  hasBlur : Boolean
Gets or sets the blur mode for the window
Window
  hasCloseX : Boolean
Gets the close X button mode for the window
Window
  hasContentFill : Boolean
Gets or sets the main content fill for the window.
Window
  hasContentFillInset : Boolean
Gets or sets the main content inset for the window.
Window
  hasDropShadow : Boolean
Gets the drop shadow mode for the window
Window
  hasTitleBG : Boolean
Gets or sets the value to signal whether to use a background inset fill behind the title in the top of the window
Window
  hasTitleInset : Boolean
Gets or sets the inset on the text used as the title in the top of the window
Window
  height : Number
[override] Gets or sets the value of the current height of the window
Window
  icon : String
Gets or sets the icon for the window.
Window
  isCentered : Boolean
Window
  isDraggable : Boolean
Gets or sets whether the window is draggable or not
Window
  isFading : Boolean
[read-only] Gets the window is currently fading.
Window
  isModal : Boolean
Gets or sets the modal mode for the window
Window
  isPaddedToTitle : Boolean
Gets or sets whether to size the title background to the title or to the window.
Window
  isVisible : Boolean
Gets or sets visibility of the window.
Window
  leftAlignTitle : Boolean
Gets or sets the left align of the title.
Window
  modalAlpha : Number
Gets or sets the alpha of the modal.
Window
  modalColor : uint
Gets or sets the color of the modal.
Window
  ratio : Number
Gets or sets the ratio used in scaling the window.
Window
  sizeToContent : Boolean
Gets or sets whether the window is sized to the content.
Window
  title : String
Gets or sets the title for the window
Window
  titleBGColor : uint
Gets or sets the color of the background of the title fill
Window
  titleBGPadding : Number
Gets or sets the padding to be used for the background title fill
Window
  titleColor : uint
Gets or sets the color value of the title text
Window
  titleFormat : TextFormat
Gets or sets the title format for the window
Window
  titleInsetColor : uint
Gets or sets the title inset color
Window
  title_txt : TextField
[read-only] Gets a reference to the content for the window
Window
  topCurve : Number
Gets or sets the amount of curve on the top corners
Window
  updateBlur : Boolean
Gets or sets whether or not to update the blur.
Window
  width : Number
[override] Gets or sets a value for the current width of the window.
Window
  x : Number
[override] Gets or sets the x value of the window.
Window
  y : Number
[override] Gets or sets the y value of the window.
Window
Public Methods
 MethodDefined By
  
Window(content:DisplayObject = null)
The default constructor has an optional content parameter.
Window
  
applyMask():void
Creates and applies a mask to the content
Window
  
build(customAlignW:Number = 0, customAlignH:Number = 0, delayTime:Number = 0):void
This function calls all the functions neccessary to build the pop-in window.
Window
  
cleanup(complete:Boolean = true):void
This function removes any and all references created by the window
Window
  
This function dispatches an event to destroy the pop in window
Window
  
fadeIn(delayTime:Number = 0, duration:Number):void
Fades window in
Window
  
fadeOut(delayTime:Number = 0, duration:Number):void
Fades window out
Window
  
rebuild(customAlignW:Number = 0, customAlignH:Number = 0):void
Rebuilds window
Window
Protected Methods
 MethodDefined By
  
onFadeOut():void
Handles when the fade out is finished
Window
Events
 Event Summary Defined By
  Dispatched when the window is destroyed by pushing the corner x button.Window
  Dispatched when the window is destroyed by pushing the corner x button and closeOnX is set to true.Window
  Dispatched when the window begins to fade in.Window
  Dispatched when the window has faded in.Window
  Dispatched when the window begins to fade out.Window
  Dispatched when the window has faded out.Window
Property Detail
autoMaskproperty
autoMask:Boolean

Gets or sets the autoMask value

The default value is true.


Implementation
    public function get autoMask():Boolean
    public function set autoMask(value:Boolean):void
blurAmountproperty 
blurAmount:Number

Gets or sets the blur amount

The default value is 5.


Implementation
    public function get blurAmount():Number
    public function set blurAmount(value:Number):void
btmCurveproperty 
btmCurve:Number

Gets or sets the amount of curve on the bottom corners

The default value is 0.


Implementation
    public function get btmCurve():Number
    public function set btmCurve(value:Number):void
btnColorproperty 
btnColor:uint

Gets or sets the color of the close button

The default value is 0xCC0000.


Implementation
    public function get btnColor():uint
    public function set btnColor(value:uint):void
btnOverColorproperty 
btnOverColor:uint

Gets or sets the color of the close button over glow

The default value is 0xFF0000.


Implementation
    public function get btnOverColor():uint
    public function set btnOverColor(value:uint):void
btnSymbolColorproperty 
btnSymbolColor:uint

Gets or sets the color of the 'X' symbol in the close button

The default value is 0xFFFFFF.


Implementation
    public function get btnSymbolColor():uint
    public function set btnSymbolColor(value:uint):void
closeOnXproperty 
closeOnX:Boolean

Gets or sets whether the window closes automatically when the X button is pressed

The default value is true.


Implementation
    public function get closeOnX():Boolean
    public function set closeOnX(value:Boolean):void
colorproperty 
color:uint

Gets or sets the color value of the window

The default value is 0x000000.


Implementation
    public function get color():uint
    public function set color(value:uint):void
colorAlphaproperty 
colorAlpha:Number

Gets or sets the alpha value of the window

The default value is 1.


Implementation
    public function get colorAlpha():Number
    public function set colorAlpha(value:Number):void
contentproperty 
content:DisplayObject

Gets or sets a reference to the content for the window

The default value is null.


Implementation
    public function get content():DisplayObject
    public function set content(value:DisplayObject):void
contentBGAlphaproperty 
contentBGAlpha:Number

Gets or sets the alpha of the inset content area for the window

The default value is .95.


Implementation
    public function get contentBGAlpha():Number
    public function set contentBGAlpha(value:Number):void
contentBGColorproperty 
contentBGColor:uint

Gets or sets the color of the content area for the window

The default value is 0xFFFFFF.


Implementation
    public function get contentBGColor():uint
    public function set contentBGColor(value:uint):void
contentHeightproperty 
contentHeight:Number

Gets or sets the value of the content height of the window

The default value is 62.


Implementation
    public function get contentHeight():Number
    public function set contentHeight(value:Number):void
contentWidthproperty 
contentWidth:Number

Gets or sets the value of the content width of the window

The default value is 86.


Implementation
    public function get contentWidth():Number
    public function set contentWidth(value:Number):void
contentXproperty 
contentX:Number

Gets or sets the value of the content starting x position

The default value is 7.


Implementation
    public function get contentX():Number
    public function set contentX(value:Number):void
contentYproperty 
contentY:Number

Gets or sets the value of the content starting y position

The default value is 29.


Implementation
    public function get contentY():Number
    public function set contentY(value:Number):void
curParentproperty 
curParent:DisplayObjectContainer

Gets or sets a reference to the parent value of the window

The default value is null.


Implementation
    public function get curParent():DisplayObjectContainer
    public function set curParent(value:DisplayObjectContainer):void
destroyOnFadeproperty 
destroyOnFade:Boolean

Gets or sets a reference to the destroyOnFade value

The default value is null.


Implementation
    public function get destroyOnFade():Boolean
    public function set destroyOnFade(value:Boolean):void
fadeInOnBuildproperty 
fadeInOnBuild:Boolean

Gets or sets whether to fade in or not when buildWindow is called

The default value is true.


Implementation
    public function get fadeInOnBuild():Boolean
    public function set fadeInOnBuild(value:Boolean):void
fadeInTimeproperty 
fadeInTime:Number

Gets or sets the time in seconds for the fade in

The default value is 2.


Implementation
    public function get fadeInTime():Number
    public function set fadeInTime(value:Number):void
fadeOutOnDestroyproperty 
fadeOutOnDestroy:Boolean

Gets or sets whether to fade out or not when destroyWindow is called

The default value is true.


Implementation
    public function get fadeOutOnDestroy():Boolean
    public function set fadeOutOnDestroy(value:Boolean):void
fadeOutTimeproperty 
fadeOutTime:Number

Gets or sets the time in seconds for the fade out

The default value is 1.


Implementation
    public function get fadeOutTime():Number
    public function set fadeOutTime(value:Number):void
hasBlurproperty 
hasBlur:Boolean

Gets or sets the blur mode for the window

The default value is true.


Implementation
    public function get hasBlur():Boolean
    public function set hasBlur(value:Boolean):void
hasCloseXproperty 
hasCloseX:Boolean

Gets the close X button mode for the window

The default value is true.


Implementation
    public function get hasCloseX():Boolean
    public function set hasCloseX(value:Boolean):void
hasContentFillproperty 
hasContentFill:Boolean

Gets or sets the main content fill for the window. When this is true a box is drawn to represent the content area. Leaving this off will leave the window at the window color with no differentiation for the content area

The default value is true.


Implementation
    public function get hasContentFill():Boolean
    public function set hasContentFill(value:Boolean):void
hasContentFillInsetproperty 
hasContentFillInset:Boolean

Gets or sets the main content inset for the window. When this is true a inset effect is drawn around the box that represents the content area.

The default value is true.


Implementation
    public function get hasContentFillInset():Boolean
    public function set hasContentFillInset(value:Boolean):void
hasDropShadowproperty 
hasDropShadow:Boolean

Gets the drop shadow mode for the window

The default value is true.


Implementation
    public function get hasDropShadow():Boolean
    public function set hasDropShadow(value:Boolean):void
hasTitleBGproperty 
hasTitleBG:Boolean

Gets or sets the value to signal whether to use a background inset fill behind the title in the top of the window

The default value is false.


Implementation
    public function get hasTitleBG():Boolean
    public function set hasTitleBG(value:Boolean):void
hasTitleInsetproperty 
hasTitleInset:Boolean

Gets or sets the inset on the text used as the title in the top of the window

The default value is false.


Implementation
    public function get hasTitleInset():Boolean
    public function set hasTitleInset(value:Boolean):void
heightproperty 
height:Number[override]

Gets or sets the value of the current height of the window

The default value is 100.


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

Gets or sets the icon for the window. Note: 24 X 24 is the optimized size

The default value is null.


Implementation
    public function get icon():String
    public function set icon(value:String):void
isCenteredproperty 
public var isCentered:Boolean

isDraggableproperty 
isDraggable:Boolean

Gets or sets whether the window is draggable or not

The default value is true.


Implementation
    public function get isDraggable():Boolean
    public function set isDraggable(value:Boolean):void
isFadingproperty 
isFading:Boolean  [read-only]

Gets the window is currently fading.

The default value is true.


Implementation
    public function get isFading():Boolean
isModalproperty 
isModal:Boolean

Gets or sets the modal mode for the window

The default value is false.


Implementation
    public function get isModal():Boolean
    public function set isModal(value:Boolean):void
isPaddedToTitleproperty 
isPaddedToTitle:Boolean

Gets or sets whether to size the title background to the title or to the window. When set to true the title background fill will size itself to the title text plus the padding. When set to false it will size to the window minus the padding

The default value is true.


Implementation
    public function get isPaddedToTitle():Boolean
    public function set isPaddedToTitle(value:Boolean):void
isVisibleproperty 
isVisible:Boolean

Gets or sets visibility of the window.

The default value is true.


Implementation
    public function get isVisible():Boolean
    public function set isVisible(value:Boolean):void
leftAlignTitleproperty 
leftAlignTitle:Boolean

Gets or sets the left align of the title.

The default value is false.


Implementation
    public function get leftAlignTitle():Boolean
    public function set leftAlignTitle(value:Boolean):void
modalAlphaproperty 
modalAlpha:Number

Gets or sets the alpha of the modal.

The default value is .25.


Implementation
    public function get modalAlpha():Number
    public function set modalAlpha(value:Number):void
modalColorproperty 
modalColor:uint

Gets or sets the color of the modal.

The default value is .25.


Implementation
    public function get modalColor():uint
    public function set modalColor(value:uint):void
ratioproperty 
ratio:Number

Gets or sets the ratio used in scaling the window.

The default value is 1.


Implementation
    public function get ratio():Number
    public function set ratio(value:Number):void
sizeToContentproperty 
sizeToContent:Boolean

Gets or sets whether the window is sized to the content.

The default value is true.


Implementation
    public function get sizeToContent():Boolean
    public function set sizeToContent(value:Boolean):void
titleproperty 
title:String

Gets or sets the title for the window

The default value is "".


Implementation
    public function get title():String
    public function set title(value:String):void
title_txtproperty 
title_txt:TextField  [read-only]

Gets a reference to the content for the window


Implementation
    public function get title_txt():TextField
titleBGColorproperty 
titleBGColor:uint

Gets or sets the color of the background of the title fill

The default value is 0xCC0000.


Implementation
    public function get titleBGColor():uint
    public function set titleBGColor(value:uint):void
titleBGPaddingproperty 
titleBGPadding:Number

Gets or sets the padding to be used for the background title fill

The default value is 6.


Implementation
    public function get titleBGPadding():Number
    public function set titleBGPadding(value:Number):void
titleColorproperty 
titleColor:uint

Gets or sets the color value of the title text

The default value is 0xFFFFFF.


Implementation
    public function get titleColor():uint
    public function set titleColor(value:uint):void
titleFormatproperty 
titleFormat:TextFormat

Gets or sets the title format for the window

The default value is 15 Arial 0xFFFFFF.


Implementation
    public function get titleFormat():TextFormat
    public function set titleFormat(value:TextFormat):void
titleInsetColorproperty 
titleInsetColor:uint

Gets or sets the title inset color

The default value is 0x000000.


Implementation
    public function get titleInsetColor():uint
    public function set titleInsetColor(value:uint):void
topCurveproperty 
topCurve:Number

Gets or sets the amount of curve on the top corners

The default value is 10.


Implementation
    public function get topCurve():Number
    public function set topCurve(value:Number):void
updateBlurproperty 
updateBlur:Boolean

Gets or sets whether or not to update the blur. This would be useful if the parent has children with movement

The default value is false.


Implementation
    public function get updateBlur():Boolean
    public function set updateBlur(value:Boolean):void
widthproperty 
width:Number[override]

Gets or sets a value for the current width of the window.

The default value is 100.


Implementation
    public function get width():Number
    public function set width(value:Number):void
xproperty 
x:Number[override]

Gets or sets the x value of the window.

The default value is 0.


Implementation
    public function get x():Number
    public function set x(value:Number):void
yproperty 
y:Number[override]

Gets or sets the y value of the window.

The default value is 0.


Implementation
    public function get y():Number
    public function set y(value:Number):void
Constructor Detail
Window()Constructor
public function Window(content:DisplayObject = null)

The default constructor has an optional content parameter. It also initializes variables

Parameters
content:DisplayObject (default = null) — Optional. Content used in the window. It saves one step in that you don't need to then call .content
Method Detail
applyMask()method
public function applyMask():void

Creates and applies a mask to the content

build()method 
public function build(customAlignW:Number = 0, customAlignH:Number = 0, delayTime:Number = 0):void

This function calls all the functions neccessary to build the pop-in window. It calls functions to build the default text formats, creates a drop shadow if needed and draw the window

Parameters

customAlignW:Number (default = 0) — A custom number used as the width of the parent. This is important when it comes to centering the window.
 
customAlignH:Number (default = 0) — A custom number used as the height of the parent. This is important when it comes to centering the window.
 
delayTime:Number (default = 0)

cleanup()method 
public function cleanup(complete:Boolean = true):void

This function removes any and all references created by the window

Parameters

complete:Boolean (default = true)

destroyWindow()method 
public function destroyWindow():void

This function dispatches an event to destroy the pop in window

fadeIn()method 
public function fadeIn(delayTime:Number = 0, duration:Number):void

Fades window in

Parameters

delayTime:Number (default = 0)
 
duration:Number (default = NaN)

fadeOut()method 
public function fadeOut(delayTime:Number = 0, duration:Number):void

Fades window out

Parameters

delayTime:Number (default = 0)
 
duration:Number (default = NaN)

onFadeOut()method 
protected function onFadeOut():void

Handles when the fade out is finished

rebuild()method 
public function rebuild(customAlignW:Number = 0, customAlignH:Number = 0):void

Rebuilds window

Parameters

customAlignW:Number (default = 0) — A custom number used as the width of the parent. This is important when it comes to centering the window.
 
customAlignH:Number (default = 0) — A custom number used as the height of the parent. This is important when it comes to centering the window.

Event Detail
CLOSE Event
Event Object Type: bf.containers.events.WindowEvent
WindowEvent.type property = bf.containers.events.WindowEvent

Dispatched when the window is destroyed by pushing the corner x button.

CLOSE_BTN Event  
Event Object Type: bf.containers.events.WindowEvent
WindowEvent.type property = bf.containers.events.WindowEvent

Dispatched when the window is destroyed by pushing the corner x button and closeOnX is set to true.

FADE_IN Event  
Event Object Type: bf.containers.events.WindowEvent
WindowEvent.type property = bf.containers.events.WindowEvent

Dispatched when the window begins to fade in.

FADE_IN_COMPLETE Event  
Event Object Type: bf.containers.events.WindowEvent
WindowEvent.type property = bf.containers.events.WindowEvent

Dispatched when the window has faded in.

FADE_OUT Event  
Event Object Type: bf.containers.events.WindowEvent
WindowEvent.type property = bf.containers.events.WindowEvent

Dispatched when the window begins to fade out.

FADE_OUT_COMPLETE Event  
Event Object Type: bf.containers.events.WindowEvent
WindowEvent.type property = bf.containers.events.WindowEvent

Dispatched when the window has faded out.

Examples
The following example creates a window, modifies some of its properties and then creates a square and adds that as content.

Note: The order of the statements is important. All changes must be made prior to calling build() and build() must be called after addChild().

Important GC Info: Make sure to listen for the close event. In that handler function make sure to remove the close listener, null the content variable if you used one, call removeChild() for the window and null out the window variable in that order.

     package
     {
         import bf.containers.Window;
        import bf.containers.events.WindowEvent;
     
         import flash.display.MovieClip; 
         import flash.display.Sprite;
     
         public class WindowExample extends MovieClip
         {
     
             private var myWindow:Window;
     
             public function WindowExample()
             {
                 _init();
             }
     
             private function _init():void
             {
                var winContent:Sprite = new Sprite();
                winContent.graphics.beginFill(0x0066CC);
                winContent.graphics.drawRect(0,0,300,225);
                winContent.graphics.endFill();
      
                 myWindow = new Window(winContent);
                 myWindow.title = "This window rocks!";
                 myWindow.hasTitleBG = true;
                 myWindow.addEventListener(WindowEvent.CLOSE, handleClose);
                 addChild(myWindow);
                 myWindow.build();
             }
     
             private function handleClose(evt:WindowEvent):void
             {
                 myWindow.removeEventListener(WindowEvent.CLOSE, handleClose);
                 removeChild(myWindow);
                 myWindow = null;
             }
         }
     }