Packagecom.soundstep.ui
Classpublic class ElementUI

Author: Romuald Quantin - www.soundstep.com
Class version: 1.1.0
Actionscript version: 3.0
Copyright: You can use BaseUI in any flash site, except to include/distribute it in another flash framework or structure that is meant to build/scaffold source files. An notification email will be welcome for a commercial use (just for information).
Date: 06-2008
Usage: Element class that contains the display information of a DisplayObject


Example
  baseUI = new BaseUI(this);
  txt = new TextField();
  txt.name = "Textfield";
  txt.text = "TexField example";
  var elText:ElementUI = baseUI.addElement(txt);
  elText.alignX = ElementUI.ALIGN_CENTER;
  elText.alignY = ElementUI.ALIGN_BOTTOM;
  elText.marginBottom = 10;
  addChild(txt);
  



Public Properties
 PropertyDefined by
  alignX : uint
get the horizontal alignment of the DisplayObject in the area (ElementUI.ALIGN_LEFT, ElementUI.ALIGN_CENTER, ElementUI.ALIGN_RIGHT)
ElementUI
  alignY : uint
get the vertical alignment of the DisplayObject in the area (ElementUI.ALIGN_TOP, ElementUI.ALIGN_CENTER, ElementUI.ALIGN_BOTTOM)
ElementUI
  bgMask : Shape
get the Shape of the mask
ElementUI
  element : DisplayObject
[read-only] get the DisplayObject
ElementUI
  hasMask : Boolean = false
wether or not the DisplayObject has a mask (for the background type and mode ratio out)
ElementUI
  horizontalAlign : Number
set the horizontal alignment value
ElementUI
  margin : Object
get the margin of a DisplayObject {top:20, bottom:10, left:10, right:20}
ElementUI
  marginBottom : Number
get the bottom margin of a DisplayObject
ElementUI
  marginLeft : Number
get the left margin of a DisplayObject
ElementUI
  marginRight : Number
get the right margin of a DisplayObject
ElementUI
  marginTop : Number
get the top margin of a DisplayObject
ElementUI
  mode : uint
get the mode used for the element (ElementUI.RATIO_FIT, ElementUI.RATIO_OUT, ElementUI.RATIO_IN)
ElementUI
  onStage : Boolean = true
wether or not the DisplayObject is resized or positioned to the stage (false with the parent DisplayObject)
ElementUI
  resizeOption : uint
get the resize option of the ElementUI (ElementUI.OPTION_ELEMENT_WIDTH, ElementUI.OPTION_ELEMENT_HEIGHT)
ElementUI
  type : uint
get the type of the ElementUI (ElementUI.TYPE_ELEMENT, ElementUI.TYPE_BACKGROUND)
ElementUI
  useInitialSize : Boolean
get if the element is using the initial size
ElementUI
  verticalAlign : Number
set the vertical alignment value
ElementUI
Public Methods
 MethodDefined by
  
Constructor Not used, instead use the addElement of the BaseUI instance
ElementUI
  
checkMask():void
build or remove the mask if the type is background and the ratio is out (internal)
ElementUI
  
dispose():void
clean the Element when removed in the BaseUI instance
ElementUI
  
forceRefresh():void
force the position and size of the DisplayObject
ElementUI
  
refresh():void
update position and size of the element, also check alpha and visible before allowing (internal)
ElementUI
  
setElement(baseUI:BaseUI, el:DisplayObject, t:uint):ElementUI
set the type of an element (internal)
ElementUI
Public Constants
 ConstantDefined by
  ALIGN_BOTTOM : uint = 5
[static] static constant to align a DisplayObject at the bottom (ElementUI.BOTTOM)
ElementUI
  ALIGN_CENTER : uint = 1
[static] static constant to align a DisplayObject at the center (ElementUI.ALIGN_CENTER)
ElementUI
  ALIGN_LEFT : uint = 2
[static] static constant to align a DisplayObject at the left (ElementUI.LEFT)
ElementUI
  ALIGN_RIGHT : uint = 3
[static] static constant to align a DisplayObject at the right (ElementUI.RIGHT)
ElementUI
  ALIGN_TOP : uint = 4
[static] static constant to align a DisplayObject at the top (ElementUI.TOP)
ElementUI
  OPTION_ELEMENT_HEIGHT : uint = 12
[static] static constant for the resizeOption of a elementUI type element (ElementUI.OPTION_ELEMENT_HEIGHT), resize the height of the element to fit the area
ElementUI
  OPTION_ELEMENT_WIDTH : uint = 11
[static] static constant for the resizeOption of a elementUI type element (ElementUI.OPTION_ELEMENT_WIDTH), resize the width of the element to fit the area
ElementUI
  RATIO_FIT : uint = 10
[static] static constant for the background type of an elementUI (ElementUI.RATIO_FIT), this is the default for the background type of background element
ElementUI
  RATIO_IN : uint = 8
[static] static constant for the background type of an elementUI (ElementUI.RATIO_IN)
ElementUI
  RATIO_OUT : uint = 9
[static] static constant for the background type of an elementUI (ElementUI.RATIO_OUT), will build a mask to handle the margin
ElementUI
  TYPE_BACKGROUND : uint = 7
[static] static constant for the type of an elementUI (ElementUI.TYPE_BACKGROUND), make you able to use the ratio fit, in and out mode
ElementUI
  TYPE_ELEMENT : uint = 6
[static] static constant for the type of an elementUI (ElementUI.TYPE_ELEMENT), this is the default for an elementUI
ElementUI
Property detail
alignXproperty
alignX:uint  [read-write]

get the horizontal alignment of the DisplayObject in the area (ElementUI.ALIGN_LEFT, ElementUI.ALIGN_CENTER, ElementUI.ALIGN_RIGHT)

Implementation
    public function get alignX():uint
    public function set alignX(value:uint):void
alignYproperty 
alignY:uint  [read-write]

get the vertical alignment of the DisplayObject in the area (ElementUI.ALIGN_TOP, ElementUI.ALIGN_CENTER, ElementUI.ALIGN_BOTTOM)

Implementation
    public function get alignY():uint
    public function set alignY(value:uint):void
bgMaskproperty 
public var bgMask:Shape

get the Shape of the mask

elementproperty 
element:DisplayObject  [read-only]

get the DisplayObject

Implementation
    public function get element():DisplayObject
hasMaskproperty 
public var hasMask:Boolean = false

wether or not the DisplayObject has a mask (for the background type and mode ratio out)

The default value is false.

horizontalAlignproperty 
horizontalAlign:Number  [read-write]

set the horizontal alignment value

Implementation
    public function get horizontalAlign():Number
    public function set horizontalAlign(value:Number):void
marginproperty 
margin:Object  [read-write]

get the margin of a DisplayObject {top:20, bottom:10, left:10, right:20}

Implementation
    public function get margin():Object
    public function set margin(value:Object):void
marginBottomproperty 
marginBottom:Number  [read-write]

get the bottom margin of a DisplayObject

Implementation
    public function get marginBottom():Number
    public function set marginBottom(value:Number):void
marginLeftproperty 
marginLeft:Number  [read-write]

get the left margin of a DisplayObject

Implementation
    public function get marginLeft():Number
    public function set marginLeft(value:Number):void
marginRightproperty 
marginRight:Number  [read-write]

get the right margin of a DisplayObject

Implementation
    public function get marginRight():Number
    public function set marginRight(value:Number):void
marginTopproperty 
marginTop:Number  [read-write]

get the top margin of a DisplayObject

Implementation
    public function get marginTop():Number
    public function set marginTop(value:Number):void
modeproperty 
mode:uint  [read-write]

get the mode used for the element (ElementUI.RATIO_FIT, ElementUI.RATIO_OUT, ElementUI.RATIO_IN)

Implementation
    public function get mode():uint
    public function set mode(value:uint):void
onStageproperty 
public var onStage:Boolean = true

wether or not the DisplayObject is resized or positioned to the stage (false with the parent DisplayObject)

The default value is true.

resizeOptionproperty 
resizeOption:uint  [read-write]

get the resize option of the ElementUI (ElementUI.OPTION_ELEMENT_WIDTH, ElementUI.OPTION_ELEMENT_HEIGHT)

Implementation
    public function get resizeOption():uint
    public function set resizeOption(value:uint):void
typeproperty 
type:uint  [read-write]

get the type of the ElementUI (ElementUI.TYPE_ELEMENT, ElementUI.TYPE_BACKGROUND)

Implementation
    public function get type():uint
    public function set type(value:uint):void
useInitialSizeproperty 
useInitialSize:Boolean  [read-write]

get if the element is using the initial size

Implementation
    public function get useInitialSize():Boolean
    public function set useInitialSize(value:Boolean):void
verticalAlignproperty 
verticalAlign:Number  [read-write]

set the vertical alignment value

Implementation
    public function get verticalAlign():Number
    public function set verticalAlign(value:Number):void
Constructor detail
ElementUI()constructor
public function ElementUI()

Constructor Not used, instead use the addElement of the BaseUI instance

Method detail
checkMask()method
public function checkMask():void

build or remove the mask if the type is background and the ratio is out (internal)

dispose()method 
public function dispose():void

clean the Element when removed in the BaseUI instance

forceRefresh()method 
public function forceRefresh():void

force the position and size of the DisplayObject

refresh()method 
public function refresh():void

update position and size of the element, also check alpha and visible before allowing (internal)

setElement()method 
public function setElement(baseUI:BaseUI, el:DisplayObject, t:uint):ElementUI

set the type of an element (internal)

Parameters
baseUI:BaseUI
 
el:DisplayObject
 
t:uint

Returns
ElementUI
Constant detail
ALIGN_BOTTOMconstant
public static const ALIGN_BOTTOM:uint = 5

static constant to align a DisplayObject at the bottom (ElementUI.BOTTOM)

ALIGN_CENTERconstant 
public static const ALIGN_CENTER:uint = 1

static constant to align a DisplayObject at the center (ElementUI.ALIGN_CENTER)

ALIGN_LEFTconstant 
public static const ALIGN_LEFT:uint = 2

static constant to align a DisplayObject at the left (ElementUI.LEFT)

ALIGN_RIGHTconstant 
public static const ALIGN_RIGHT:uint = 3

static constant to align a DisplayObject at the right (ElementUI.RIGHT)

ALIGN_TOPconstant 
public static const ALIGN_TOP:uint = 4

static constant to align a DisplayObject at the top (ElementUI.TOP)

OPTION_ELEMENT_HEIGHTconstant 
public static const OPTION_ELEMENT_HEIGHT:uint = 12

static constant for the resizeOption of a elementUI type element (ElementUI.OPTION_ELEMENT_HEIGHT), resize the height of the element to fit the area

OPTION_ELEMENT_WIDTHconstant 
public static const OPTION_ELEMENT_WIDTH:uint = 11

static constant for the resizeOption of a elementUI type element (ElementUI.OPTION_ELEMENT_WIDTH), resize the width of the element to fit the area

RATIO_FITconstant 
public static const RATIO_FIT:uint = 10

static constant for the background type of an elementUI (ElementUI.RATIO_FIT), this is the default for the background type of background element

RATIO_INconstant 
public static const RATIO_IN:uint = 8

static constant for the background type of an elementUI (ElementUI.RATIO_IN)

RATIO_OUTconstant 
public static const RATIO_OUT:uint = 9

static constant for the background type of an elementUI (ElementUI.RATIO_OUT), will build a mask to handle the margin

TYPE_BACKGROUNDconstant 
public static const TYPE_BACKGROUND:uint = 7

static constant for the type of an elementUI (ElementUI.TYPE_BACKGROUND), make you able to use the ratio fit, in and out mode

TYPE_ELEMENTconstant 
public static const TYPE_ELEMENT:uint = 6

static constant for the type of an elementUI (ElementUI.TYPE_ELEMENT), this is the default for an elementUI