diff --git a/src/as/com/threerings/flash/DisplayUtil.as b/src/as/com/threerings/flash/DisplayUtil.as index 24f3137b..bc82de00 100644 --- a/src/as/com/threerings/flash/DisplayUtil.as +++ b/src/as/com/threerings/flash/DisplayUtil.as @@ -31,6 +31,17 @@ import flash.geom.Rectangle; public class DisplayUtil { + /** + * Sets the top-left pixel of a DisplayObject to the given location, taking the + * object's bounds into account. + */ + public static function positionBounds (disp :DisplayObject, x :Number, y :Number) :void + { + var bounds :Rectangle = disp.getBounds(disp); + disp.x = x - bounds.left; + disp.y = y - bounds.top; + } + /** * Sorts a container's children, using ArrayUtil.stableSort. *