| Package | com.yahoo.astra.layout | 
| Class | public class LayoutContainer | 
| Inheritance | LayoutContainer  flash.display.Sprite | 
| Implements | ILayoutContainer | 
  // create an instance of a layout mode
  var mode:ILayoutMode = new BoxLayout();
  mode.direction = "horizontal";
  mode.horizontalGap = 10;
  
  // one may pass the mode to the constructor or the layoutMode property.
  // note: by default, a LayoutContainer will automatically determine
  // its size based on its content.
  var container:LayoutContainer = new LayoutContainer( mode );
  this.addChild(container);
  
  for( var i:int = 0; i < 5; i++ )
  {
      var square:Shape = new Shape();
      square.graphics.beginFill(0xcccccc);
      square.graphics.drawRect(0, 0, 25, 25);
      square.graphics.endFill();
      container.addChild(square);
  }
  Important Note: LayoutContainer leaves certain functionality to the implementor to complete. No scrollbars or other user interface controls will appear when the contents are larger than the LayoutContainer's dimensions.
This limitation is deliberate and by design. The philosophy behind this choice centers on allowing an ActionScript developer to use these classes as a basis for implementing layout controls for nearly any user interface library available for Flash Player.
For a reference implementation of full-featured UI controls that implement masking and scrolling, please take a look at the Layout Containers available in the Yahoo! Astra Components for Flash CS3.
See also
| Property | Defined by | ||
|---|---|---|---|
| autoMask : Boolean 
   If true, the conent will automatically update the scrollRect to fit
   the dimensions. | LayoutContainer | ||
| contentHeight : Number [read-only]
   
   The height of the content displayed by the layout container. | LayoutContainer | ||
| contentWidth : Number [read-only]
   
   The width of the content displayed by the layout container. | LayoutContainer | ||
| layoutMode : ILayoutMode 
   
   The layout algorithm used to display children of the layout container. | LayoutContainer | ||
| Method | Defined by | ||
|---|---|---|---|
| 
LayoutContainer(mode:ILayoutMode = null) 
   Constructor. | LayoutContainer | ||
| 
invalidateLayout():void 
   
   Informs the layout container that it should update the layout of its
   children. | LayoutContainer | ||
| 
validateLayout():void 
   
   Immediately updates the layout of the container's children. | LayoutContainer | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when this container's layout changes. | LayoutContainer | |||
| autoMask | property | 
autoMask:Boolean  [read-write]If true, the conent will automatically update the scrollRect to fit the dimensions. Uses explicit dimensions if width or height is set by the developer. Otherwise, uses the content dimensions. If false, it is up to the implementor to set the mask or scrollRect.
Implementation    public function get autoMask():Boolean
    public function set autoMask(value:Boolean):void
| contentHeight | property | 
contentHeight:Number  [read-only]The height of the content displayed by the layout container.
Implementation    public function get contentHeight():Number
| contentWidth | property | 
contentWidth:Number  [read-only]The width of the content displayed by the layout container.
Implementation    public function get contentWidth():Number
| layoutMode | property | 
layoutMode:ILayoutMode  [read-write]The layout algorithm used to display children of the layout container.
Implementation    public function get layoutMode():ILayoutMode
    public function set layoutMode(value:ILayoutMode):void
| LayoutContainer | () | constructor | 
public function LayoutContainer(mode:ILayoutMode = null)Constructor.
Parameters| mode:ILayoutMode(default =null)—  The ILayoutMode implementation to use. | 
| invalidateLayout | () | method | 
public function invalidateLayout():voidInforms the layout container that it should update the layout of its children.
| validateLayout | () | method | 
public function validateLayout():voidImmediately updates the layout of the container's children.
| layoutChange | event | 
com.yahoo.astra.layout.events.LayoutEvent
com.yahoo.astra.layout.events.LayoutEvent.LAYOUT_CHANGE
Dispatched when this container's layout changes.
   The LayoutEvent.LAYOUT_CHANGE event type constant indicates that
   the layout of an ILayoutContainer needs to be redrawn.