Moved these here from inside metasoy.
Grid changed into GridUtil. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@143 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// $Id$
|
||||
|
||||
package com.threerings.flex {
|
||||
|
||||
import flash.display.DisplayObjectContainer;
|
||||
|
||||
import mx.core.ContainerCreationPolicy;
|
||||
import mx.core.UIComponent;
|
||||
import mx.containers.VBox;
|
||||
|
||||
public class LazyContainer extends VBox
|
||||
{
|
||||
/**
|
||||
* Create a lazy container that will not create its children
|
||||
* until needed.
|
||||
*
|
||||
* @param creation a function that takes no args and returns
|
||||
* a UIComponent to be added to the container.
|
||||
*/
|
||||
public function LazyContainer (creation :Function)
|
||||
{
|
||||
_creation = creation;
|
||||
creationPolicy = ContainerCreationPolicy.NONE;
|
||||
}
|
||||
|
||||
override public function createComponentsFromDescriptors (
|
||||
recurse :Boolean = true) :void
|
||||
{
|
||||
super.createComponentsFromDescriptors(recurse);
|
||||
|
||||
if (_creation != null) {
|
||||
addChild(_creation() as UIComponent);
|
||||
_creation = null; // assist gc
|
||||
}
|
||||
}
|
||||
|
||||
protected var _creation :Function;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user