Packagenet.guttershark.managers
Classpublic final class LayoutManager

The LayoutManager class adds shortcuts for layout, and layer management with a display objects children.

DisplayObject's must have their registration point at 0,0 in order for the align / stage align methods to function correctly. Otherwise you'll see shifts in what is expected.


Example
Using a layout manager from a CoreClip.
 
  public class MyClip extends CoreClip
  {
      public function MyClip()
      {
          super(); //critical
          
          var mc1:MovieClip = new MovieClip();
          //draw vector box in mc1 here...
         
          var mc2:MovieClip = new MovieClip();
          //draw vector box in mc2 here...
          
          var mc3:MovieClip = new MovieClip();
          //draw vector box in mc3 here...
          
          lm.addChildren(mc1,mc2,mc3); //shortcut to add multiple children.
          
          lm.bringInFront(mc1,mc2); //moves mc1 in front of mc2.
          lm.sendToBack(mc1); //sends mc1 all the way to the back.
          lm.bringForward(mc2); //brings mc2 forward (in front of mc3).
      }
  }
  

Using a layout manager manually.
 
  var lm:LayoutManager = new LayoutManager(this);
  
  var mc1:MovieClip = new MovieClip();
  //draw box in mc1
  
  var mc2:MovieClip = new MovieClip();
  //draw box in mc2
  
  var mc3:MovieClip = new MovieClip();
  //draw box in mc3
  
  lm.addChildren(mc1,mc2,mc3);
  lm.bringToFront(mc1); //moves mc1 in front
  

There is also an extended example in guttershark/examples/managers/layoutmanager/

See also

CoreClip lm property
CoreSprite lm property


Public Properties
 PropertyDefined by
  ignoreStageAlign : Boolean = true
[static] Ignore the stage align property and correctly translate stage alignment operations to the actual stage viewport - meaning if the stage.align property is anything other than undefined or TOP_LEFT, correctly translate the positioning offsets that occur when setting x and y.
LayoutManager
  wholePixels : Boolean = true
[static] Whether or not to use whole pixels on for x and y coordinates.
LayoutManager
Protected Properties
 PropertyDefined by
  container : DisplayObjectContainer
The container in which layering operations will occur.
LayoutManager
Public Methods
 MethodDefined by
  
LayoutManager(target:DisplayObjectContainer)
Constructor for LayoutManager instances.
LayoutManager
  
addChildren(... children):void
Add all children specified to the display list.
LayoutManager
  
addChildrenTo(target:DisplayObjectContainer, ... children):void
Add all children specified onto the display list of the target container.
LayoutManager
  
alignBottom(target:DisplayObject, relativeTo:DisplayObject):void
Align a display object to the bottom edge of another display object.
LayoutManager
  
alignBottomCenter(target:DisplayObject, relativeTo:DisplayObject):void
Align a display object to the bottom center of another display object.
LayoutManager
  
alignBottomLeft(target:DisplayObject, relativeTo:DisplayObject):void
Align a display object to the bottom left corner of another display object.
LayoutManager
  
alignBottomRight(target:DisplayObject, relativeTo:DisplayObject):void
Align a display object to the bottom right corner of another display object.
LayoutManager
  
alignCenter(target:DisplayObject, relativeTo:DisplayObject):void
Align a display object to the dead center of another display object.
LayoutManager
  
alignLeft(target:DisplayObject, relativeTo:DisplayObject):void
Align the target display object to the left edge of another display object.
LayoutManager
  
alignMiddleLeft(target:DisplayObject, relativeTo:DisplayObject):void
Align a display object to the left middle of another display object.
LayoutManager
  
alignMiddleRight(target:DisplayObject, relativeTo:DisplayObject):void
Align a display object to the right middle of another display object.
LayoutManager
  
alignRight(target:DisplayObject, relativeTo:DisplayObject):void
Align the target display object to the right edge of another display object.
LayoutManager
  
alignTop(target:DisplayObject, relativeTo:DisplayObject):void
Align a display object to the top edge of another display object.
LayoutManager
  
alignTopCenter(target:DisplayObject, relativeTo:DisplayObject):void
Align a display object to the top center of another display object.
LayoutManager
  
alignTopLeft(target:DisplayObject, relativeTo:DisplayObject):void
Align a display object to the top left corner of another display object.
LayoutManager
  
alignTopRight(target:DisplayObject, relativeTo:DisplayObject):void
Align a display object to the top right corner of another display object.
LayoutManager
  
alignXCenter(target:DisplayObject, relativeTo:DisplayObject):void
Align the target display object centered on the x coordinate relatively to another display object.
LayoutManager
  
alignYCenter(target:DisplayObject, relativeTo:DisplayObject):void
Align the target display object centered on the y coordinate relatively to another display object.
LayoutManager
  
bringForward(target:DisplayObject):void
Bring a display object forward 1 layer.
LayoutManager
  
bringInFront(target:DisplayObject, relativeTo:DisplayObject):void
Bring a target display object in front of another display object.
LayoutManager
  
bringToFront(target:DisplayObject):void
Bring the target display object to the top most layer.
LayoutManager
  
Remove all children from the display list.
LayoutManager
  
removeAllChildrenFrom(target:DisplayObjectContainer):void
Remove all children from the display list of the specified target object.
LayoutManager
  
removeChildren(... children):void
Remove all children specified from the display list.
LayoutManager
  
sendBackward(target:DisplayObject):void
Send the target display object backward 1 layer.
LayoutManager
  
sendBehind(target:DisplayObject, relativeTo:DisplayObject):void
Send a target display object behind another display object.
LayoutManager
  
sendToBack(target:DisplayObject):void
Send the target display object to bottom most layer.
LayoutManager
  
stageAlignBottom(target:DisplayObject):void
Align the target display object to the bottom edge of the stage.
LayoutManager
  
stageAlignBottomCenter(target:DisplayObject):void
Align the target display object to the bottom center of the stage.
LayoutManager
  
stageAlignBottomLeft(target:DisplayObject):void
Align the target display object to the bottom left corner of the stage.
LayoutManager
  
stageAlignBottomRight(target:DisplayObject):void
Align the target display object to the bottom right corner of the stage.
LayoutManager
  
stageAlignCenter(target:DisplayObject):void
Align the target display object to the dead center of the stage.
LayoutManager
  
stageAlignLeft(target:DisplayObject):void
Align the target display object to the left edge of the stage.
LayoutManager
  
stageAlignMiddleLeft(target:DisplayObject):void
Align the target display object to the left middle of the stage.
LayoutManager
  
stageAlignMiddleRight(target:DisplayObject):void
Align the target display object to the right middle of the stage.
LayoutManager
  
stageAlignRight(target:DisplayObject):void
Align the target display object to the right edge of the stage.
LayoutManager
  
stageAlignTop(target:DisplayObject):void
Align the target display object to the top edge of the stage.
LayoutManager
  
stageAlignTopCenter(target:DisplayObject):void
Align the target display object to the top center of the stage.
LayoutManager
  
stageAlignTopLeft(target:DisplayObject):void
Align the target display object to the top left corner of the stage.
LayoutManager
  
stageAlignTopRight(target:DisplayObject):void
Align the target display object to the top right corner of the stage.
LayoutManager
  
stageAlignXCenter(target:DisplayObject):void
Align the target display object centered on the x coordinate relatively to the stage.
LayoutManager
  
stageAlignYCenter(item:DisplayObject):void
Align the target display object centered on the y coordinate relatively to the stage.
LayoutManager
Property detail
containerproperty
protected var container:DisplayObjectContainer

The container in which layering operations will occur.

ignoreStageAlignproperty 
public static var ignoreStageAlign:Boolean = true

Ignore the stage align property and correctly translate stage alignment operations to the actual stage viewport - meaning if the stage.align property is anything other than undefined or TOP_LEFT, correctly translate the positioning offsets that occur when setting x and y.

wholePixelsproperty 
public static var wholePixels:Boolean = true

Whether or not to use whole pixels on for x and y coordinates.

Constructor detail
LayoutManager()constructor
public function LayoutManager(target:DisplayObjectContainer)

Constructor for LayoutManager instances.

Parameters
target:DisplayObjectContainer
Method detail
addChildren()method
public function addChildren(... children):void

Add all children specified to the display list.

Parameters
... children — An array of display objects to add.
addChildrenTo()method 
public function addChildrenTo(target:DisplayObjectContainer, ... children):void

Add all children specified onto the display list of the target container.

Parameters
target:DisplayObjectContainer — A display object to add the spefified children onto.
 
... children — An array of display objects to add.
alignBottom()method 
public function alignBottom(target:DisplayObject, relativeTo:DisplayObject):void

Align a display object to the bottom edge of another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignBottomCenter()method 
public function alignBottomCenter(target:DisplayObject, relativeTo:DisplayObject):void

Align a display object to the bottom center of another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignBottomLeft()method 
public function alignBottomLeft(target:DisplayObject, relativeTo:DisplayObject):void

Align a display object to the bottom left corner of another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignBottomRight()method 
public function alignBottomRight(target:DisplayObject, relativeTo:DisplayObject):void

Align a display object to the bottom right corner of another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignCenter()method 
public function alignCenter(target:DisplayObject, relativeTo:DisplayObject):void

Align a display object to the dead center of another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignLeft()method 
public function alignLeft(target:DisplayObject, relativeTo:DisplayObject):void

Align the target display object to the left edge of another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignMiddleLeft()method 
public function alignMiddleLeft(target:DisplayObject, relativeTo:DisplayObject):void

Align a display object to the left middle of another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignMiddleRight()method 
public function alignMiddleRight(target:DisplayObject, relativeTo:DisplayObject):void

Align a display object to the right middle of another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignRight()method 
public function alignRight(target:DisplayObject, relativeTo:DisplayObject):void

Align the target display object to the right edge of another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignTop()method 
public function alignTop(target:DisplayObject, relativeTo:DisplayObject):void

Align a display object to the top edge of another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignTopCenter()method 
public function alignTopCenter(target:DisplayObject, relativeTo:DisplayObject):void

Align a display object to the top center of another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignTopLeft()method 
public function alignTopLeft(target:DisplayObject, relativeTo:DisplayObject):void

Align a display object to the top left corner of another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignTopRight()method 
public function alignTopRight(target:DisplayObject, relativeTo:DisplayObject):void

Align a display object to the top right corner of another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignXCenter()method 
public function alignXCenter(target:DisplayObject, relativeTo:DisplayObject):void

Align the target display object centered on the x coordinate relatively to another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
alignYCenter()method 
public function alignYCenter(target:DisplayObject, relativeTo:DisplayObject):void

Align the target display object centered on the y coordinate relatively to another display object.

Parameters
target:DisplayObject — The target display object to align.
 
relativeTo:DisplayObject — The target display object that target will be aligned to.
bringForward()method 
public function bringForward(target:DisplayObject):void

Bring a display object forward 1 layer.

Parameters
target:DisplayObject — The target display object.
bringInFront()method 
public function bringInFront(target:DisplayObject, relativeTo:DisplayObject):void

Bring a target display object in front of another display object.

Parameters
target:DisplayObject — The target display object to re-layer.
 
relativeTo:DisplayObject — The display object in which the target will be brought in front of.
bringToFront()method 
public function bringToFront(target:DisplayObject):void

Bring the target display object to the top most layer.

Parameters
target:DisplayObject — The target display object.
removeAllChildren()method 
public function removeAllChildren():void

Remove all children from the display list.

removeAllChildrenFrom()method 
public function removeAllChildrenFrom(target:DisplayObjectContainer):void

Remove all children from the display list of the specified target object.

Parameters
target:DisplayObjectContainer — The target display object container whose children will be removed.
removeChildren()method 
public function removeChildren(... children):void

Remove all children specified from the display list.

Parameters
... children — The children to remove.
sendBackward()method 
public function sendBackward(target:DisplayObject):void

Send the target display object backward 1 layer.

Parameters
target:DisplayObject — The target display object.
sendBehind()method 
public function sendBehind(target:DisplayObject, relativeTo:DisplayObject):void

Send a target display object behind another display object.

Parameters
target:DisplayObject — The target display object to re-layer.
 
relativeTo:DisplayObject — The display object in which the target will be moved behind.
sendToBack()method 
public function sendToBack(target:DisplayObject):void

Send the target display object to bottom most layer.

Parameters
target:DisplayObject — The target display object.
stageAlignBottom()method 
public function stageAlignBottom(target:DisplayObject):void

Align the target display object to the bottom edge of the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignBottomCenter()method 
public function stageAlignBottomCenter(target:DisplayObject):void

Align the target display object to the bottom center of the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignBottomLeft()method 
public function stageAlignBottomLeft(target:DisplayObject):void

Align the target display object to the bottom left corner of the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignBottomRight()method 
public function stageAlignBottomRight(target:DisplayObject):void

Align the target display object to the bottom right corner of the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignCenter()method 
public function stageAlignCenter(target:DisplayObject):void

Align the target display object to the dead center of the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignLeft()method 
public function stageAlignLeft(target:DisplayObject):void

Align the target display object to the left edge of the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignMiddleLeft()method 
public function stageAlignMiddleLeft(target:DisplayObject):void

Align the target display object to the left middle of the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignMiddleRight()method 
public function stageAlignMiddleRight(target:DisplayObject):void

Align the target display object to the right middle of the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignRight()method 
public function stageAlignRight(target:DisplayObject):void

Align the target display object to the right edge of the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignTop()method 
public function stageAlignTop(target:DisplayObject):void

Align the target display object to the top edge of the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignTopCenter()method 
public function stageAlignTopCenter(target:DisplayObject):void

Align the target display object to the top center of the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignTopLeft()method 
public function stageAlignTopLeft(target:DisplayObject):void

Align the target display object to the top left corner of the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignTopRight()method 
public function stageAlignTopRight(target:DisplayObject):void

Align the target display object to the top right corner of the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignXCenter()method 
public function stageAlignXCenter(target:DisplayObject):void

Align the target display object centered on the x coordinate relatively to the stage.

Parameters
target:DisplayObject — The target display object to align.
stageAlignYCenter()method 
public function stageAlignYCenter(item:DisplayObject):void

Align the target display object centered on the y coordinate relatively to the stage.

Parameters
item:DisplayObject — The target display object to align.