/**
* 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;
}
* 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;
}
浙公网安备 33010602011771号