Convenience functions

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@765 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Tom Conkling
2009-01-27 23:14:12 +00:00
parent 7db745258e
commit badfd4b612
@@ -31,6 +31,28 @@ import flash.geom.Rectangle;
public class DisplayUtil
{
/**
* Adds newChild to container, directly below another child of the container.
*/
public static function addChildBelow (container :DisplayObjectContainer,
newChild :DisplayObject,
below :DisplayObject) :void
{
var ii :int = (below.parent == container ? container.getChildIndex(below) : 0);
container.addChildAt(newChild, ii);
}
/**
* Adds newChild to container, directly above another child of the container.
*/
public static function addChildAbove (container :DisplayObjectContainer,
newChild :DisplayObject,
above :DisplayObject) :void
{
var ii :int = (above.parent == container ? container.getChildIndex(above) + 1 : 0);
container.addChildAt(newChild, ii);
}
/**
* Sets the top-left pixel of a DisplayObject to the given location, relative to another
* DisplayObject's coordinate space.