public static function getContentBounds(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;
}
Search This Blog
Monday, 5 October 2009
Get real content size
if you need the real size of the content in a display object with a scroll rect applied you can use pixel bound combined with the tranformation matrix. The following example returns the unscaled values. I just needed it once, but this was the only way it worked for me:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment