YUI AS Component Documentation | All Packages | All Classes | Index | Frames No Frames |
Class LayoutManager

Package | com.yahoo.astra.layout
Class | public class LayoutManager

Generic layout manager for DisplayObjects.

See also

flash.display.DisplayObject
com.yahoo.astra.layout.ILayoutContainer

Public Methods

| Method | Defined by
--- | --- | ---
|  | hasInvalidatingEvents(target:DisplayObject):Boolean [static] Determines if a particular DisplayObject's type has been registered with invalidating events. | LayoutManager
|  | invalidateParentLayout(target:DisplayObject):void [static] If the target's parent is a layout container, that parent will be informed that it needs to update the layout. | LayoutManager
|  | registerContainerChild(child:DisplayObject):void [static] Called by an ILayoutContainer implementation when a child is added. | LayoutManager
|  | registerInvalidatingEvents(source:Class, events:Array):void [static] Allows users to specify events that invalidate the parent layout container when fired by instances of a specific class. | LayoutManager
|  | resize(target:DisplayObject, width:Number, height:Number):void [static] If a DisplayObject that is placed into a layout container doesn't fire events for size changes, calling this function will allow its size to properly affect its parent layout. | LayoutManager
|  | unregisterContainerChild(child:DisplayObject):void [static] Called by a layout container when a child is removed. | LayoutManager
|  | update(target:DisplayObject, property:String, value:Object):void [static] Similar to `LayoutManager.resize()`, this function may be called to update any property of a DisplayObject and notify its parent layout container to refresh if no event normally indicates this is needed. | LayoutManager

Method detail

hasInvalidatingEvents | () | method

`public static function hasInvalidatingEvents(target:DisplayObject):Boolean`

Determines if a particular DisplayObject's type has been registered with invalidating events.

Parameters

| `target:DisplayObject`

Returns

| `Boolean`

invalidateParentLayout | () | method |

`public static function invalidateParentLayout(target:DisplayObject):void`

If the target's parent is a layout container, that parent will be informed that it needs to update the layout.

Parameters

| `target:DisplayObject`

registerContainerChild | () | method |

`public static function registerContainerChild(child:DisplayObject):void`

Called by an ILayoutContainer implementation when a child is added. If the child is an instance of a class with registered events, the layout system will listen for those events.

Parameters

| `child:DisplayObject`

See also

ILayoutContainer

registerInvalidatingEvents | () | method |

`public static function registerInvalidatingEvents(source:Class, events:Array):void`

Allows users to specify events that invalidate the parent layout container when fired by instances of a specific class.

For example, if `fl.core.UIComponent` fires the `resize` event when it is inside a layout container, the layout container will refresh its layout.

Parameters

| `source:Class` — The class that will fire invalidating events (ie. TextField)
| `events:Array` — An Array of event constants (ie. Event.CHANGE)

Example
The following code demonstrates how to specify a set of invalidating events:

       LayoutManager.registerInvalidatingEvents( UIComponent, [ComponentEvent.RESIZE, ComponentEvent.MOVE] );

resize | () | method |

`public static function resize(target:DisplayObject, width:Number, height:Number):void`

If a DisplayObject that is placed into a layout container doesn't fire events for size changes, calling this function will allow its size to properly affect its parent layout.

Parameters

| `target:DisplayObject` — The display object to resize
| `width:Number` — The new width of the display object
| `height:Number` — The new height of the display object

Example
The following code demonstrates how to resize a DisplayObject that doesn't fire an event when it resizes:

       LayoutManager.resize( mySprite, 100, 34 );

unregisterContainerChild | () | method |

`public static function unregisterContainerChild(child:DisplayObject):void`

Called by a layout container when a child is removed. If the child is an instance of a class with registered events, the layout system will stop listening to those events.

Parameters

| `child:DisplayObject`

See also

ILayoutContainer

update | () | method |

`public static function update(target:DisplayObject, property:String, value:Object):void`

Similar to `LayoutManager.resize()`, this function may be called to update any property of a DisplayObject and notify its parent layout container to refresh if no event normally indicates this is needed.

Parameters

| `target:DisplayObject` — The display object whose property will be changed
| `property:String` — The name of the property.
| `value:Object` — The value of the property

Example
The following code demonstrates how to change a DisplayObject's property when that DisplayObject doesn't fire an event when the property changes:

       LayoutManager.update(mySprite, "transform", new Transform());