Am I missing an easy way to draw a rectangle box around a rotated object?
The following code gives me the middle result in the illustration below, but I want the blue rectangle instead.
var w:uint = image.width * image.scaleX; var h:uint = image.height * image.scaleY; canvas.graphics.clear();canvas.graphics.beginFill(0xff0000, .6); canvas.graphics.drawRect(image.x, image.y, w, h);
I thought maybe doing an image.right - image.left might work, but I can't seem to figure out how to get that to work. How would I draw the blue rectangle? Thanks!
I guess I'll answer my own question... I was hoping for an easy answer but it looks like you have to do all the maths yourself. Here's a C# solution: http://www.codeproject.com/KB/graphics/rotateimage.aspx
If you rotate an object, I would think its transform.pixelBounds would
That's definitely the right answer. I guess I should look at the docs harder. I looked at matrix, and displayobject, but neglected to read transform in-depth. Thanks.