Packagecom.soundstep.ui
Classpublic class BaseUI
InheritanceBaseUI 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);
  



Public Properties
 PropertyDefined by
  autoRefresh : Boolean
whether or not the size/position of the DisplayObject is recalculate after a property change
this is a global default value applied on every DisplayObject added to the BaseUI instance, it can be overridden in each ElementUI instance
BaseUI
  elements : Array
[read-only] get the ElementUI list
BaseUI
  holder : DisplayObjectContainer
[read-only] return the holder
BaseUI
  keepOnScreen : Boolean
keep a DisplayObject in the screen
this is a global default value applied on every DisplayObject added to the BaseUI instance, it can be overridden in each ElementUI instance
BaseUI
  onStage : Boolean
set the stage as a reference to calculate position ans sizes, if false the parent will be the reference this is a global default value applied on every DisplayObject added to the BaseUI instance, it can be overridden in each ElementUI instance
BaseUI
  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) this is a global default value applied on every DisplayObject added to the BaseUI instance, it can be overridden in each ElementUI instance
BaseUI
Public Methods
 MethodDefined by
  
BaseUI(holder:DisplayObjectContainer)
Constructor Create an instance of the BaseUI class
BaseUI
  
add(displayObject:DisplayObject):ElementUI
add a element to the BaseUI list (DisplayObject like Sprite, MovieClip, TextField, Bitmap, ...)
BaseUI
  
contains(displayObject:DisplayObject):Boolean
whether or not the BaseUI instance contains the DisplayObject
BaseUI
  
dispose():void
Call this method to remove children, event listeners or whatever that needs to be destroyed to free the memory (make the instance elligible to the Garbage Collection).
BaseUI
  
getElement(displayObject:DisplayObject):ElementUI
get the ElementUI instance
BaseUI
  
refresh():void
refresh all the elements
BaseUI
  
remove(displayObject:DisplayObject):void
remove a element from the BaseUI list
BaseUI
  
removeAll():void
remove all elements from the BaseUI list
BaseUI
Events
 EventSummaryDefined by
   Dispatched when a display object has been added to the BaseUI instance.BaseUI
   Dispatched when a display object has been removed from the BaseUI instance.BaseUI
Property detail
autoRefreshproperty
autoRefresh:Boolean  [read-write]

whether or not the size/position of the DisplayObject is recalculate after a property change
this is a global default value applied on every DisplayObject added to the BaseUI instance, it can be overridden in each ElementUI instance

The default value is true.

Implementation
    public function get autoRefresh():Boolean
    public function set autoRefresh(value:Boolean):void
elementsproperty 
elements:Array  [read-only]

get the ElementUI list

Implementation
    public function get elements():Array
holderproperty 
holder:DisplayObjectContainer  [read-only]

return the holder

Implementation
    public function get holder():DisplayObjectContainer
keepOnScreenproperty 
keepOnScreen:Boolean  [read-write]

keep a DisplayObject in the screen
this is a global default value applied on every DisplayObject added to the BaseUI instance, it can be overridden in each ElementUI instance

The default value is true.

Implementation
    public function get keepOnScreen():Boolean
    public function set keepOnScreen(value:Boolean):void
onStageproperty 
onStage:Boolean  [read-write]

set the stage as a reference to calculate position ans sizes, if false the parent will be the reference this is a global default value applied on every DisplayObject added to the BaseUI instance, it can be overridden in each ElementUI instance

The default value is true.

Implementation
    public function get onStage():Boolean
    public function set onStage(value:Boolean):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) this is a global default value applied on every DisplayObject added to the BaseUI instance, it can be overridden in each ElementUI instance

Implementation
    public function get reference():DisplayObjectContainer
    public function set reference(value:DisplayObjectContainer):void
Constructor detail
BaseUI()constructor
public function BaseUI(holder:DisplayObjectContainer)

Constructor Create an instance of the BaseUI class

Parameters
holder:DisplayObjectContainer — DisplayObjectContainer of the BaseUI instance that will contains the elements
Method detail
add()method
public function add(displayObject:DisplayObject):ElementUI

add a element to the BaseUI list (DisplayObject like Sprite, MovieClip, TextField, Bitmap, ...)

Parameters
displayObject:DisplayObject — DisplayObject instance of the element to be added to the BaseUI list

Returns
ElementUI — return an instance ElementUI
contains()method 
public function contains(displayObject:DisplayObject):Boolean

whether or not the BaseUI instance contains the DisplayObject

Parameters
displayObject:DisplayObject

Returns
Boolean — Boolean
dispose()method 
public function dispose():void

Call this method to remove children, event listeners or whatever that needs to be destroyed to free the memory (make the instance elligible to the Garbage Collection).

getElement()method 
public function getElement(displayObject:DisplayObject):ElementUI

get the ElementUI instance

Parameters
displayObject:DisplayObject — DisplayObject instance of the DisplayObject

Returns
ElementUI — return the ElementUI instance of the DisplayObject
refresh()method 
public function refresh():void

refresh all the elements

remove()method 
public function remove(displayObject:DisplayObject):void

remove a element from the BaseUI list

Parameters
displayObject:DisplayObject — DisplayObject instance of the element to be removed from the BaseUI list
removeAll()method 
public function removeAll():void

remove all elements from the BaseUI list

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

Dispatched when a display object has been added to the BaseUI instance.

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

Dispatched when a display object has been removed from the BaseUI instance.