Scale Error | Precision Problems width, height, getBounds | ActionScript 3.0 (AS3)
Last Updated on Thursday, 10 June 2010 14:59 Written by Nicholas Dunbar
Precision Pitfalls Between getRect and Width/Height
Keep in mind when you are using
var boundingBox:Rectangle = mc.getRect(coordSystem)
or
var boundingBox:Rectangle = mc.getBounds(coordSystem)
the Rectangle returned will be of a greater precision than mc.x, mc.y, mc.width and mc.height
trace (mc.width == boundingBox.width)
will often return false.
Also keep in mind that getRect and getBounds also can return different results depending on the contents of the DisplayObject.
getBounds returns a rectangle that defines the area of the display object including lines and shapes
getRect returns the rectangle including the extra gurth added by outline strokes on shapes.
Set as favorite
Bookmark
Email This
Hits: 172
Comments (0)

Write comment

