I've never used those two methods before, but when I do the following, I get unexpected/wrong sizes:
<s:Button id="button" x="200" width="100" height="100" />
<s:Panel id="panel" x="200" width="100" height="100" rotation="45"/>
<s:Button id="button2" x="400" width="100" height="100" />
<s:Button id="button3" x="400" width="100" height="100" rotation="45" />
var rect:Rectangle = panel.getRect(this);
button.width = rect.width;
button.height = rect.height;
rect = button3.getRect(this.stage);
button2.width = rect.width;
button2.height = rect.height;
If I use the "getBounds()" method, same thing: The button is almost the header's height larger than the rotated panel. If I use two buttons, the rect is almost the size of the other rotated button, but there's still a little gap. I've attached an image of what it looks like.
What am I doing wrong/how can I get the bounds of the rotated object so the rectangle perfectly surrounds it?
the getLayoutBounds[PROP] methods make it work
When you get the rectangle that surrounds the object it will have an offset of at least 1 pixel(its the rect around the object after all). In the case of your button at 100x100 the surrounding rect is 102x102 then you rotate at 45 now the surrounding rect is 102/0.707 so its over 1 pixel becuase of the rotation. With the panel you have the shadow so a 200x200 panel is more like 220x220 draw rect before you apply rotation. There is a getvisibleRect function but i'm not sure how this applies to rotated objects.
Thanks David, that's good to know.
The getVisibleRect doesn't include rotation changes