| Package | com.soundstep.ui.layouts |
| Class | public class CanvasUI |
| Inheritance | CanvasUI flash.display.MovieClip |
| Subclasses | HBoxUI, TileUI, VBoxUI |
// create layout
var canvas:CanvasUI = new CanvasUI();
addChild(canvas);
canvas.canvasAlpha = .2;
// add children
var s:Sprite = new Sprite();
s.name = "mySprite";
s.graphics.beginFill(0x0000FF, .5);
s.graphics.drawRect(0, 0, 150, 300);
canvas.addChildUI(s);
canvas.getChildUIByName("mySprite").right = 20;
canvas.getChildUI(s).bottom = 20;
var txt:TextField = new TextField();
txt.name = "myTextField";
txt.autoSize = TextFieldAutoSize.LEFT;
txt.text = "TextField test";
canvas.addChildUI(txt);
canvas.getChildUIByName("myTextField").horizontalCenter = 0;
canvas.getChildUI(txt).verticalCenter = 0;
// change canvas ui property
canvas.ratio = ElementUI.RATIO_IN;
canvas.properties = {top:10, bottom:10, left:10, right:10};
| Property | Defined 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 | CanvasUI | ||
| 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 | CanvasUI | ||
| baseUI : BaseUI
[read-only]
get the instance of the BaseUI class, used for the children added with addChild or addChildUI
| CanvasUI | ||
| bottom : Number
bottom value (from the reference), Number or String
| CanvasUI | ||
| buttonMode : Boolean
Specifies the button mode of this sprite
| CanvasUI | ||
| bypassSize : Boolean
whether or not the DisplayObject will be resized (not working with ratio set to RATIO_IN or RATIO_OUT)
| CanvasUI | ||
| canvasAlpha : Number
background alpha of the canvas
| CanvasUI | ||
| canvasColor : uint
background color of the canvas
| CanvasUI | ||
| container : Sprite [read-only]
get the instance of the container, it contains the children added with addChild and addChildUI
| CanvasUI | ||
| forceReferenceHeight : Number
force the height of the reference
| CanvasUI | ||
| forceReferenceWidth : Number
force the width of the reference
| CanvasUI | ||
| height : Number
height of the canvas
| CanvasUI | ||
| horizontalCenter : Number
horizontal center value (from the reference), Number or String
| CanvasUI | ||
| initialWidth : Number
width of the DisplayObject when added to the BaseUI instance
| CanvasUI | ||
| keepOnScreen : Boolean
keep a DisplayObject in the screen
| CanvasUI | ||
| layoutMask : Mask
[read-only]
get the instance of the mask
| CanvasUI | ||
| left : Number
left value (from the reference), Number or String
| CanvasUI | ||
| mouseChildren : Boolean
Determines whether or not the children of the object are mouse enabled
| CanvasUI | ||
| numChildren : int [read-only]
Returns the number of children of the CanvasUI container
| CanvasUI | ||
| onStage : Boolean
set the stage as a reference to calculate position ans sizes, if false the parent will be the reference
| CanvasUI | ||
| percentHeight : * [write-only]
set the height percentage (will accept Number or String, with or without the percentage character
| CanvasUI | ||
| percentWidth : * [write-only]
set the width percentage (will accept Number or String, with or without the percentage character
| CanvasUI | ||
| properties : Object
Object to get or set the CanvasUI properties, for example:
element.properties = {top:0, bottom:"20", onStage:false, width:"50%"};
| CanvasUI | ||
| ratio : String
type of ratio of the CanvasUI, 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 | CanvasUI | ||
| 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) | CanvasUI | ||
| right : Number
right value (from the reference), Number or String
| CanvasUI | ||
| scrollPane : * [read-only]
get the instance of the scrollpane used for the scrollbars
you must cast the return: Scrollpane(canvas.scrollpane), the wild card has been used not to import the SCrollpane classes if not used | CanvasUI | ||
| top : Number
top value (from the reference), Number or String
| CanvasUI | ||
| ui : ElementUI
[read-only]
get a the wrapper ElementUI instance
| CanvasUI | ||
| 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 | CanvasUI | ||
| verticalCenter : Number
vertical center value (from the reference), Number or String
| CanvasUI | ||
| width : Number
width of the canvas
| CanvasUI | ||
| wrapper : Wrapper
[read-only]
get the instance of the wrapper
| CanvasUI | ||
| x : Number
x position of the canvas, Number or String
| CanvasUI | ||
| y : Number
y position of the canvas
| CanvasUI | ||
| Method | Defined by | ||
|---|---|---|---|
|
CanvasUI(widthLayout:Number = 100, heightLayout:Number = 100, layoutScrollbar:Boolean = true, layoutMask:Boolean = true)
Constructor
Create an instance of the CanvasUI class
| CanvasUI | ||
|
addChild(child:DisplayObject):DisplayObject
Adds a child DisplayObject instance to this CanvasUI container
| CanvasUI | ||
|
addChildAt(child:DisplayObject, index:int):DisplayObject
Adds a child DisplayObject instance to the CanvasUI container
| CanvasUI | ||
|
addChildUI(child:DisplayObject):ElementUI
add a child DisplayObject instance to the canvas and create a ElementUI instance
| CanvasUI | ||
|
contains(child:DisplayObject):Boolean
Determines whether or not the specified display object is a child of the CanvasUI container or the instance itself
| CanvasUI | ||
|
forceSizeContainer(width:Number, height:Number):void
function to force the size of the container (will update the scrollbars if used)
| CanvasUI | ||
|
getChildAt(index:int):DisplayObject
Returns the child display object instance that exists at the specified index
| CanvasUI | ||
|
getChildByName(name:String):DisplayObject
Returns the child display object that exists with the specified name
| CanvasUI | ||
|
getChildIndex(child:DisplayObject):int
Returns the index position of a child DisplayObject instance
| CanvasUI | ||
|
getChildUI(child:DisplayObject):ElementUI
get a child ElementUI instance
| CanvasUI | ||
|
getChildUIByName(name:String):ElementUI
get a child ElementUI instance using the name
| CanvasUI | ||
|
refresh(e:BaseEventUI = null):void
refresh the canvas elements and its children position
| CanvasUI | ||
|
removeChild(child:DisplayObject):DisplayObject
Removes the specified child DisplayObject instance from the child list of the CanvasUI container
| CanvasUI | ||
|
removeChildAt(index:int):DisplayObject
Removes a child DisplayObject from the specified index position in the child list of the DisplayObjectContainer
| CanvasUI | ||
|
removeChildUI(child:DisplayObject):void
remove a child from the BaseUI instance
| CanvasUI | ||
|
setChildIndex(child:DisplayObject, index:int):void
Changes the position of an existing child in the CanvasUI container
| CanvasUI | ||
|
swapChildren(child1:DisplayObject, child2:DisplayObject):void
Swaps the z-order (front-to-back order) of the two specified child objects
| CanvasUI | ||
|
swapChildrenAt(index1:int, index2:int):void
Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the child list.
| CanvasUI | ||
| alignX | property |
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
public function get alignX():String
public function set alignX(value:String):void
| alignY | property |
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
public function get alignY():String
public function set alignY(value:String):void
| baseUI | property |
baseUI:BaseUI [read-only]get the instance of the BaseUI class, used for the children added with addChild or addChildUI
Implementation public function get baseUI():BaseUI
| bottom | property |
bottom:Number [read-write]bottom value (from the reference), Number or String
Implementation public function get bottom():Number
public function set bottom(value:Number):void
| buttonMode | property |
buttonMode:Boolean [read-write]Specifies the button mode of this sprite
Implementation public function get buttonMode():Boolean
public function set buttonMode(value:Boolean):void
| bypassSize | property |
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
| canvasAlpha | property |
canvasAlpha:Number [read-write]background alpha of the canvas
The default value is Number 0.
public function get canvasAlpha():Number
public function set canvasAlpha(value:Number):void
| canvasColor | property |
canvasColor:uint [read-write]background color of the canvas
The default value is uint 0x000000.
public function get canvasColor():uint
public function set canvasColor(value:uint):void
| container | property |
container:Sprite [read-only]get the instance of the container, it contains the children added with addChild and addChildUI
Implementation public function get container():Sprite
| forceReferenceHeight | property |
forceReferenceHeight:Number [read-write]force the height of the reference
Implementation public function get forceReferenceHeight():Number
public function set forceReferenceHeight(value:Number):void
| forceReferenceWidth | property |
forceReferenceWidth:Number [read-write]force the width of the reference
Implementation public function get forceReferenceWidth():Number
public function set forceReferenceWidth(value:Number):void
| height | property |
height:Number [read-write]height of the canvas
Implementation public function get height():Number
public function set height(value:Number):void
| horizontalCenter | property |
horizontalCenter:Number [read-write]horizontal center value (from the reference), Number or String
Implementation public function get horizontalCenter():Number
public function set horizontalCenter(value:Number):void
| initialWidth | property |
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
| keepOnScreen | property |
keepOnScreen:Boolean [read-write]keep a DisplayObject in the screen
Implementation public function get keepOnScreen():Boolean
public function set keepOnScreen(value:Boolean):void
| layoutMask | property |
layoutMask:Mask [read-only]get the instance of the mask
Implementation public function get layoutMask():Mask
| left | property |
left:Number [read-write]left value (from the reference), Number or String
Implementation public function get left():Number
public function set left(value:Number):void
| mouseChildren | property |
mouseChildren:Boolean [read-write]Determines whether or not the children of the object are mouse enabled
Implementation public function get mouseChildren():Boolean
public function set mouseChildren(value:Boolean):void
| numChildren | property |
numChildren:int [read-only]Returns the number of children of the CanvasUI container
Implementation public function get numChildren():int
| onStage | property |
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
| percentHeight | property |
percentHeight:* [write-only]set the height percentage (will accept Number or String, with or without the percentage character
Implementation public function set percentHeight(value:*):void
| percentWidth | property |
percentWidth:* [write-only]set the width percentage (will accept Number or String, with or without the percentage character
Implementation public function set percentWidth(value:*):void
| properties | property |
properties:Object [read-write]
Object to get or set the CanvasUI properties, for example:
element.properties = {top:0, bottom:"20", onStage:false, width:"50%"};
public function get properties():Object
public function set properties(value:Object):void
| ratio | property |
ratio:String [read-write]
type of ratio of the CanvasUI, 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
public function get ratio():String
public function set ratio(value:String):void
| reference | property |
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)
public function get reference():DisplayObjectContainer
public function set reference(value:DisplayObjectContainer):void
| right | property |
right:Number [read-write]right value (from the reference), Number or String
Implementation public function get right():Number
public function set right(value:Number):void
| scrollPane | property |
scrollPane:* [read-only]
get the instance of the scrollpane used for the scrollbars
you must cast the return: Scrollpane(canvas.scrollpane), the wild card has been used not to import the SCrollpane classes if not used
public function get scrollPane():*
| top | property |
top:Number [read-write]top value (from the reference), Number or String
Implementation public function get top():Number
public function set top(value:Number):void
| ui | property |
ui:ElementUI [read-only]get a the wrapper ElementUI instance
Implementation public function get ui():ElementUI
| useInitialSize | property |
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
public function get useInitialSize():Boolean
public function set useInitialSize(value:Boolean):void
| verticalCenter | property |
verticalCenter:Number [read-write]vertical center value (from the reference), Number or String
Implementation public function get verticalCenter():Number
public function set verticalCenter(value:Number):void
| width | property |
width:Number [read-write]width of the canvas
Implementation public function get width():Number
public function set width(value:Number):void
| wrapper | property |
wrapper:Wrapper [read-only]get the instance of the wrapper
Implementation public function get wrapper():Wrapper
| x | property |
x:Number [read-write]x position of the canvas, Number or String
Implementation public function get x():Number
public function set x(value:Number):void
| y | property |
y:Number [read-write]y position of the canvas
Implementation public function get y():Number
public function set y(value:Number):void
| CanvasUI | () | constructor |
public function CanvasUI(widthLayout:Number = 100, heightLayout:Number = 100, layoutScrollbar:Boolean = true, layoutMask:Boolean = true)Constructor Create an instance of the CanvasUI class
ParameterswidthLayout:Number (default = 100) — width of the canvas
|
|
heightLayout:Number (default = 100) — height of the canvas
|
|
layoutScrollbar:Boolean (default = true) — whether or not the canvas creates and uses a mask to show only the content within the canvas
|
|
layoutMask:Boolean (default = true) — whether or not the canvas creates and uses scrollbars if the content is bigger than the canvas (scrollpane instance)
|
| addChild | () | method |
public override function addChild(child:DisplayObject):DisplayObjectAdds a child DisplayObject instance to this CanvasUI container
Parameterschild:DisplayObject — DisplayObject
|
DisplayObject — DisplayObject
|
| addChildAt | () | method |
public override function addChildAt(child:DisplayObject, index:int):DisplayObjectAdds a child DisplayObject instance to the CanvasUI container
Parameterschild:DisplayObject — DisplayObject
|
|
index:int — int depth
|
DisplayObject — DisplayObject
|
| addChildUI | () | method |
public function addChildUI(child:DisplayObject):ElementUIadd a child DisplayObject instance to the canvas and create a ElementUI instance
Parameterschild:DisplayObject — DisplayObject
|
ElementUI —
ElementUI instance of the DisplayObject
|
| contains | () | method |
public override function contains(child:DisplayObject):BooleanDetermines whether or not the specified display object is a child of the CanvasUI container or the instance itself
Parameterschild:DisplayObject — DisplayObject
|
Boolean — Boolean
|
| forceSizeContainer | () | method |
public function forceSizeContainer(width:Number, height:Number):voidfunction to force the size of the container (will update the scrollbars if used)
Parameterswidth:Number — Number
|
|
height:Number — Number
|
| getChildAt | () | method |
public override function getChildAt(index:int):DisplayObjectReturns the child display object instance that exists at the specified index
Parametersindex:int — int
|
DisplayObject — DisplayObject
|
| getChildByName | () | method |
public override function getChildByName(name:String):DisplayObjectReturns the child display object that exists with the specified name
Parametersname:String — String
|
DisplayObject — DisplayObject
|
| getChildIndex | () | method |
public override function getChildIndex(child:DisplayObject):intReturns the index position of a child DisplayObject instance
Parameterschild:DisplayObject — DisplayObject
|
int — int
|
| getChildUI | () | method |
public function getChildUI(child:DisplayObject):ElementUIget a child ElementUI instance
Parameterschild:DisplayObject — DisplayObject
|
ElementUI —
ElementUI instance of the DisplayObject
|
| getChildUIByName | () | method |
public function getChildUIByName(name:String):ElementUIget a child ElementUI instance using the name
Parametersname:String — String
|
ElementUI —
ElementUI instance of the DisplayObject
|
| refresh | () | method |
public function refresh(e:BaseEventUI = null):voidrefresh the canvas elements and its children position
Parameterse:BaseEventUI (default = null) |
| removeChild | () | method |
public override function removeChild(child:DisplayObject):DisplayObjectRemoves the specified child DisplayObject instance from the child list of the CanvasUI container
Parameterschild:DisplayObject — DisplayObject
|
DisplayObject — DisplayObject
|
| removeChildAt | () | method |
public override function removeChildAt(index:int):DisplayObjectRemoves a child DisplayObject from the specified index position in the child list of the DisplayObjectContainer
Parametersindex:int — int
|
DisplayObject — DisplayObject
|
| removeChildUI | () | method |
public function removeChildUI(child:DisplayObject):voidremove a child from the BaseUI instance
Parameterschild:DisplayObject — DisplayObject
|
| setChildIndex | () | method |
public override function setChildIndex(child:DisplayObject, index:int):voidChanges the position of an existing child in the CanvasUI container
Parameterschild:DisplayObject — DisplayObject
|
|
index:int — int new depth
|
| swapChildren | () | method |
public override function swapChildren(child1:DisplayObject, child2:DisplayObject):voidSwaps the z-order (front-to-back order) of the two specified child objects
Parameterschild1:DisplayObject — DisplayObject
|
|
child2:DisplayObject — DisplayObject
|
| swapChildrenAt | () | method |
public override function swapChildrenAt(index1:int, index2:int):voidSwaps the z-order (front-to-back order) of the child objects at the two specified index positions in the child list.
Parametersindex1:int — int
|
|
index2:int — int
|