Packageqnx.ui.core
Classpublic class Spacer
InheritanceSpacer Inheritance flash.display.Sprite
Implements IContainable

The Spacer class is used to provide space between child items within a container.

In the sample application (which is included with the Container class documentation), the Back and Next buttons are positioned at the far bottom-right side of the bottom subcontainer. This is accomplished by setting the align property to ContainerAlign.FAR but also by adding a spacer as the first subcomponent in the container:

     mySubBottom.addChild(new Spacer()); 
     

By default, the spacer is set to take up 100 percent of the container, which pushes the other two components to the far right of the container. Below, a second spacer is added to provide spacing between the buttons.

    mySubBottom.addChild(leftButton);
    mySubBottom.addChild(new Spacer(3,SizeUnit.PIXELS));
    mySubBottom.addChild(rightButton);
     

The second spacer is added to the container between the buttons. The Spacer is set to 3 pixels wide. The container is shown below:

Opposite flow and size

Note that you can also set the padding property on the Container class to add uniform amounts of space between child components in a container.

See also

Container padding property


Public Properties
 PropertyDefined By
  containment : String
Gets or sets a String which specifies how a component is contained within a parent container.
Spacer
  size : Number
Gets or sets the size of the spacer.
Spacer
  sizeMode : String
Gets or sets the size mode for this component.
Spacer
  sizeUnit : String
Gets or sets the unit of measure for the spacer.
Spacer
Public Methods
 MethodDefined By
  
Spacer(s:Number = 100, su:String = percent)
Creates a Spacer instance, given a size and unit of measure.
Spacer
  
setPosition(x:Number, y:Number):void
Gets or sets the position of the spacer, given the x and y coordinates.
Spacer
  
setSize(width:Number, height:Number):void
Sets the size of the spacer, given the width and height.
Spacer
Property Detail
containmentproperty
containment:String

Gets or sets a String which specifies how a component is contained within a parent container. Possible values are:


Implementation
    public function get containment():String
    public function set containment(value:String):void

See also

sizeproperty 
size:Number

Gets or sets the size of the spacer.


Implementation
    public function get size():Number
    public function set size(value:Number):void

See also

sizeModeproperty 
sizeMode:String

Gets or sets the size mode for this component. This property is used by containers when laying out the component. Possible values are:

Note this property is ignored when size is 0.


Implementation
    public function get sizeMode():String
    public function set sizeMode(value:String):void

See also

sizeUnitproperty 
sizeUnit:String

Gets or sets the unit of measure for the spacer.


Implementation
    public function get sizeUnit():String
    public function set sizeUnit(value:String):void

See also

Constructor Detail
Spacer()Constructor
public function Spacer(s:Number = 100, su:String = percent)

Creates a Spacer instance, given a size and unit of measure.

The default value is SizeUnit.PERCENT.

Parameters
s:Number (default = 100) — A Number representing the size of the spacer. The default value is 100 (the default unit is percent).
 
su:String (default = percent) — A String representing the unit. Can be one of SizeUnit.PERCENT or SizeUnit.PIXELS.

See also

Method Detail
setPosition()method
public function setPosition(x:Number, y:Number):void

Gets or sets the position of the spacer, given the x and y coordinates.

Parameters

x:Number — The x coordinate of the spacer.
 
y:Number — The y coordinate of the spacer.

setSize()method 
public function setSize(width:Number, height:Number):void

Sets the size of the spacer, given the width and height.

Parameters

width:Number — The width of the spacer.
 
height:Number — The height of the spacer.