loadin Do…

一条只能往前走的路,叫时光.

首页 联系 订阅 管理
/**
 * This function works like DisplayObject.getBounds(), except it will find the full
 * bounds of any display object, even after its scrollRect has been set.
 *
 * @param displayObject - a display object that may have a scrollRect applied
 * @return a rectangle describing the dimensions of the unmasked content
 */
public function getFullBounds ( displayObject:DisplayObject ) :Rectangle
{
    var bounds:Rectangle, transform:Transform,toGlobalMatrix:Matrix, currentMatrix:Matrix;
 
    transform = displayObject.transform;
    currentMatrix = transform.matrix;
    toGlobalMatrix = transform.concatenatedMatrix;
    toGlobalMatrix.invert();
    transform.matrix = toGlobalMatrix;
 
    bounds = transform.pixelBounds.clone();
 
    transform.matrix = currentMatrix;
 
    return bounds;
}
posted on 2009-07-27 16:29  i'am sl  阅读(126)  评论(0)    收藏  举报