Packagecom.soundstep.ui
Classpublic class ElementUI
InheritanceElementUI Inheritance flash.events.EventDispatcher

Author: Romuald Quantin - www.soundstep.com
Class version: 3.0.2
Actionscript version: 3.0
Copyright: Creative Commons Attribution-ShareAlike 3.0 Unported License
http://creativecommons.org/licenses/by-sa/3.0/
You can use BaseUI in any flash site, except to include/distribute it in another framework, application, template, component or structure that is meant to build, scaffold or generate source files.

Date: 08-2008
Usage:
Manage a list of elements (Element UI) to be displayed
you can use the following properties to handle the position and sizes of the DisplayObject registered:
x, y, left, right, top, bottom, width (also percentage), height (also percentage), horizontalCenter, verticalCenter, ratio, alignX, alignY


Example
  var baseUI:BaseUI = new BaseUI(this);
  var element:ElementUI = baseUI.add(mySprite);
  element.right = 10;
  element.bottom = 10;
  element.width = "50%"
  element.height = 200;
  addChild(mySprite);
  

the list of the properties used to change position and sizes are: x, y, left, right, top, bottom, width, height, horizontalCenter, verticalCenter, ratio, alignX, alignY



Public Properties
 PropertyDefined by
  alignX : String
horizontal alignment when the property ratio is set to ElementUI.RATIO_IN or ElementUI.RATIO_OUT
can accept ElementUI.ALIGN_LEFT, ElementUI.ALIGN_RIGHT, ElementUI.ALIGN_CENTER
ElementUI
  alignY : String
vertical alignment when the property ratio is set to ElementUI.RATIO_IN or ElementUI.RATIO_OUT
can accept ElementUI.ALIGN_CENTER, ElementUI.ALIGN_TOP, ElementUI.ALIGN_BOTTOM
ElementUI
  autoRefresh : Boolean
whether or not the size/position of the DisplayObject is recalculate after a property change
ElementUI
  baseUI : BaseUI
[read-only] return the BaseUI instance that has created the ElementUI
ElementUI
  bgMask : Shape
[read-only] get the Shape instance of the mask used when the ratio is set to ElementUI.RATIO_OUT
ElementUI
  bottom : Number
value between the bottom of the reference (stage or parent) and the ElementUI, Number or String
ElementUI
  bypassSize : Boolean
whether or not the DisplayObject will be resized (not working with ratio set to RATIO_IN or RATIO_OUT)
ElementUI
  element : DisplayObject
[read-only] get the DisplayObject handle by the ElementUI instance
ElementUI
  forceReferenceHeight : Number
force the height of the reference
ElementUI
  forceReferenceWidth : Number
force the width of the reference
ElementUI
  hasMask : Boolean
[read-only] whether or not the ElementUI has a mask applied, used when the ratio is set to ElementUI.RATIO_OUT
ElementUI
  height : *
ElementUI
  horizontalCenter : Number
value from the center of the reference (stage or parent), align the ElementUI to the center on the x axis, Number or String
ElementUI
  initialHeight : Number
height of the DisplayObject when added to the BaseUI instance
ElementUI
  initialWidth : Number
width of the DisplayObject when added to the BaseUI instance
ElementUI
  keepOnScreen : Boolean
keep a DisplayObject in the screen
ElementUI
  left : Number
value between the left of the reference (stage or parent) and the ElementUI, Number or String
ElementUI
  memorized : Object
[read-only] return an Object containing the value memorized
ElementUI
  name : String
name of the ElementUI
ElementUI
  onStage : Boolean
set the stage as a reference to calculate position ans sizes, if false the parent will be the reference
ElementUI
  properties : Object
Object to get or set the ElementUI properties, for example:
element.properties = {top:0, bottom:"20", onStage:false, width:"50%"};
ElementUI
  ratio : String
type of ratio of the ElementUI, can be ElementUI.RATIO_IN or ElementUI.RATIO_OUT
any other String will set the ratio to none
the following properties cannot be set or are not used a ratio has been specified:
x, y, width, height, horizontalCenter and verticalCenter
ElementUI
  reference : DisplayObjectContainer
specify a DisplayObjectContainer reference on which the size and position of the ElementUI will refer to
if not set, the onStage property value is the reference (onStage true = stage, onStage false = parent)
ElementUI
  right : Number
value between the right of the reference (stage or parent) and the ElementUI, Number or String
ElementUI
  rounded : Boolean = true
Specify the ElementUI instance to display rounded values
ElementUI
  screenHeight : Number
[read-only] height of the ElementUI that will be displayed on the screen (after calculation)
ElementUI
  screenWidth : Number
[read-only] width of the ElementUI that will be displayed on the screen (after calculation)
ElementUI
  top : Number
value between the top of the reference (stage or parent) and the ElementUI, Number or String
ElementUI
  useInitialSize : Boolean
use the size that has been recorded when the DisplayObject has been added to the BaseUI instance
useful when a mask or other DisplayObject can disturb the real size of the DisplayObject
ElementUI
  verticalCenter : Number
value from the center of the reference (stage or parent), align the ElementUI to the center on the y axis, Number or String
ElementUI
  width : *
width of the ElementUI, Number, String or percentage value
ElementUI
  x : Number
position on the x axis of the ElementUI instance, Number or String
ElementUI
  y : Number
position on the y axis of the ElementUI instance, Number or String
ElementUI
Public Methods
 MethodDefined by
  
ElementUI(baseUI:BaseUI, displayObject:DisplayObject)
Constructor Not used, instead use the add method of the BaseUI instance to create an element
ElementUI
  
dispose():void
remove the mask when the ratio is set to ElementUI.RATIO_OUT, used internally in BaseUI
ElementUI
  
forceRefresh():void
refresh the position and sizes, bypassing the refresh function
ElementUI
  
refresh():void
refresh the position and sizes only if the the DisplayObject is visible or if the alpha property is superior to 0
ElementUI
Events
 EventSummaryDefined by
   Dispatched before updating the DisplayObject ElementUI
   Dispatched when a display object has been updated ElementUI
Public Constants
 ConstantDefined by
  ALIGN_BOTTOM : String = "bottom"
[static] static constant for the alignment (property alignY) in mode ratio_in or ratio_out (ElementUI.ALIGN_BOTTOM)
ElementUI
  ALIGN_CENTER : String = "center"
[static] static constant for the alignment (property alignX and alignY) in mode ratio_in or ratio_out (ElementUI.ALIGN_CENTER)
ElementUI
  ALIGN_LEFT : String = "left"
[static] static constant for the alignment (property alignX) in mode ratio_in or ratio_out (ElementUI.ALIGN_LEFT)
ElementUI
  ALIGN_RIGHT : String = "right"
[static] static constant for the alignment (property alignX) in mode ratio_in or ratio_out (ElementUI.ALIGN_RIGHT)
ElementUI
  ALIGN_TOP : String = "top"
[static] static constant for the alignment (property alignY) in mode ratio_in or ratio_out (ElementUI.ALIGN_TOP)
ElementUI
  RATIO_IN : String = "ratio_in"
[static] static constant for the mode ratio_in (ElementUI.RATIO_IN)
ElementUI
  RATIO_OUT : String = "ratio_out"
[static] static constant for the mode ratio_out (ElementUI.RATIO_OUT)
ElementUI
Property detail
alignXproperty
alignX:String  [read-write]

horizontal alignment when the property ratio is set to ElementUI.RATIO_IN or ElementUI.RATIO_OUT
can accept ElementUI.ALIGN_LEFT, ElementUI.ALIGN_RIGHT, ElementUI.ALIGN_CENTER

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

vertical alignment when the property ratio is set to ElementUI.RATIO_IN or ElementUI.RATIO_OUT
can accept ElementUI.ALIGN_CENTER, ElementUI.ALIGN_TOP, ElementUI.ALIGN_BOTTOM

Implementation
    public function get alignY():String
    public function set alignY(value:String):void
autoRefreshproperty 
autoRefresh:Boolean  [read-write]

whether or not the size/position of the DisplayObject is recalculate after a property change

The default value is true.

Implementation
    public function get autoRefresh():Boolean
    public function set autoRefresh(value:Boolean):void
baseUIproperty 
baseUI:BaseUI  [read-only]

return the BaseUI instance that has created the ElementUI

Implementation
    public function get baseUI():BaseUI
bgMaskproperty 
bgMask:Shape  [read-only]

get the Shape instance of the mask used when the ratio is set to ElementUI.RATIO_OUT

Implementation
    public function get bgMask():Shape
bottomproperty 
bottom:Number  [read-write]

value between the bottom of the reference (stage or parent) and the ElementUI, Number or String

Implementation
    public function get bottom():Number
    public function set bottom(value:Number):void
bypassSizeproperty 
bypassSize:Boolean  [read-write]

whether or not the DisplayObject will be resized (not working with ratio set to RATIO_IN or RATIO_OUT)

Implementation
    public function get bypassSize():Boolean
    public function set bypassSize(value:Boolean):void
elementproperty 
element:DisplayObject  [read-only]

get the DisplayObject handle by the ElementUI instance

Implementation
    public function get element():DisplayObject
forceReferenceHeightproperty 
forceReferenceHeight:Number  [read-write]

force the height of the reference

Implementation
    public function get forceReferenceHeight():Number
    public function set forceReferenceHeight(value:Number):void
forceReferenceWidthproperty 
forceReferenceWidth:Number  [read-write]

force the width of the reference

Implementation
    public function get forceReferenceWidth():Number
    public function set forceReferenceWidth(value:Number):void
hasMaskproperty 
hasMask:Boolean  [read-only]

whether or not the ElementUI has a mask applied, used when the ratio is set to ElementUI.RATIO_OUT

Implementation
    public function get hasMask():Boolean
heightproperty 
height:*  [read-write]Implementation
    public function get height():*
    public function set height(value:*):void
horizontalCenterproperty 
horizontalCenter:Number  [read-write]

value from the center of the reference (stage or parent), align the ElementUI to the center on the x axis, Number or String

Implementation
    public function get horizontalCenter():Number
    public function set horizontalCenter(value:Number):void
initialHeightproperty 
initialHeight:Number  [read-write]

height of the DisplayObject when added to the BaseUI instance

Implementation
    public function get initialHeight():Number
    public function set initialHeight(value:Number):void
initialWidthproperty 
initialWidth:Number  [read-write]

width of the DisplayObject when added to the BaseUI instance

Implementation
    public function get initialWidth():Number
    public function set initialWidth(value:Number):void
keepOnScreenproperty 
keepOnScreen:Boolean  [read-write]

keep a DisplayObject in the screen

Implementation
    public function get keepOnScreen():Boolean
    public function set keepOnScreen(value:Boolean):void
leftproperty 
left:Number  [read-write]

value between the left of the reference (stage or parent) and the ElementUI, Number or String

Implementation
    public function get left():Number
    public function set left(value:Number):void
memorizedproperty 
memorized:Object  [read-only]

return an Object containing the value memorized

Implementation
    public function get memorized():Object
nameproperty 
public var name:String

name of the ElementUI

onStageproperty 
onStage:Boolean  [read-write]

set the stage as a reference to calculate position ans sizes, if false the parent will be the reference

Implementation
    public function get onStage():Boolean
    public function set onStage(value:Boolean):void
propertiesproperty 
properties:Object  [read-write]

Object to get or set the ElementUI properties, for example:
element.properties = {top:0, bottom:"20", onStage:false, width:"50%"};

Implementation
    public function get properties():Object
    public function set properties(value:Object):void
ratioproperty 
ratio:String  [read-write]

type of ratio of the ElementUI, can be ElementUI.RATIO_IN or ElementUI.RATIO_OUT
any other String will set the ratio to none
the following properties cannot be set or are not used a ratio has been specified:
x, y, width, height, horizontalCenter and verticalCenter

Implementation
    public function get ratio():String
    public function set ratio(value:String):void
referenceproperty 
reference:DisplayObjectContainer  [read-write]

specify a DisplayObjectContainer reference on which the size and position of the ElementUI will refer to
if not set, the onStage property value is the reference (onStage true = stage, onStage false = parent)

Implementation
    public function get reference():DisplayObjectContainer
    public function set reference(value:DisplayObjectContainer):void
rightproperty 
right:Number  [read-write]

value between the right of the reference (stage or parent) and the ElementUI, Number or String

Implementation
    public function get right():Number
    public function set right(value:Number):void
roundedproperty 
public var rounded:Boolean = true

Specify the ElementUI instance to display rounded values

screenHeightproperty 
screenHeight:Number  [read-only]

height of the ElementUI that will be displayed on the screen (after calculation)

Implementation
    public function get screenHeight():Number
screenWidthproperty 
screenWidth:Number  [read-only]

width of the ElementUI that will be displayed on the screen (after calculation)

Implementation
    public function get screenWidth():Number
topproperty 
top:Number  [read-write]

value between the top of the reference (stage or parent) and the ElementUI, Number or String

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

use the size that has been recorded when the DisplayObject has been added to the BaseUI instance
useful when a mask or other DisplayObject can disturb the real size of the DisplayObject

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

value from the center of the reference (stage or parent), align the ElementUI to the center on the y axis, Number or String

Implementation
    public function get verticalCenter():Number
    public function set verticalCenter(value:Number):void
widthproperty 
width:*  [read-write]

width of the ElementUI, Number, String or percentage value

Implementation
    public function get width():*
    public function set width(value:*):void
xproperty 
x:Number  [read-write]

position on the x axis of the ElementUI instance, Number or String

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

position on the y axis of the ElementUI instance, Number or String

Implementation
    public function get y():Number
    public function set y(value:Number):void
Constructor detail
ElementUI()constructor
public function ElementUI(baseUI:BaseUI, displayObject:DisplayObject)

Constructor Not used, instead use the add method of the BaseUI instance to create an element

Parameters
baseUI:BaseUI — instance of the BaseUI that creates the element
 
displayObject:DisplayObject — instance o the DisplayObject that will be handle by the ElementUI instance
Method detail
dispose()method
public function dispose():void

remove the mask when the ratio is set to ElementUI.RATIO_OUT, used internally in BaseUI

forceRefresh()method 
public function forceRefresh():void

refresh the position and sizes, bypassing the refresh function

refresh()method 
public function refresh():void

refresh the position and sizes only if the the DisplayObject is visible or if the alpha property is superior to 0

Event detail
BEFORE_UPDATEevent 
Event object type: com.soundstep.ui.events.BaseEventUI

Dispatched before updating the DisplayObject

UPDATEDevent  
Event object type: com.soundstep.ui.events.BaseEventUI

Dispatched when a display object has been updated

Constant detail
ALIGN_BOTTOMconstant
public static const ALIGN_BOTTOM:String = "bottom"

static constant for the alignment (property alignY) in mode ratio_in or ratio_out (ElementUI.ALIGN_BOTTOM)

ALIGN_CENTERconstant 
public static const ALIGN_CENTER:String = "center"

static constant for the alignment (property alignX and alignY) in mode ratio_in or ratio_out (ElementUI.ALIGN_CENTER)

ALIGN_LEFTconstant 
public static const ALIGN_LEFT:String = "left"

static constant for the alignment (property alignX) in mode ratio_in or ratio_out (ElementUI.ALIGN_LEFT)

ALIGN_RIGHTconstant 
public static const ALIGN_RIGHT:String = "right"

static constant for the alignment (property alignX) in mode ratio_in or ratio_out (ElementUI.ALIGN_RIGHT)

ALIGN_TOPconstant 
public static const ALIGN_TOP:String = "top"

static constant for the alignment (property alignY) in mode ratio_in or ratio_out (ElementUI.ALIGN_TOP)

RATIO_INconstant 
public static const RATIO_IN:String = "ratio_in"

static constant for the mode ratio_in (ElementUI.RATIO_IN)

RATIO_OUTconstant 
public static const RATIO_OUT:String = "ratio_out"

static constant for the mode ratio_out (ElementUI.RATIO_OUT)