3 Replies Latest reply on Aug 25, 2010 10:44 PM by mynormalnamesarenotavail

    How do I draw a rectangle so that it encompasses a rotated rectangle?


      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!