10 Replies Latest reply on Jun 22, 2007 8:47 AM by injpix

    How to magnify a rounded rectangle

    Swirlsky
      Hello,

      How to magnify a rounded rectangle if I would like the size of it's rounded corners to stay fix? The script I draw the rectangle with:

      function DrawRoundedRectangle(X:Number, Y:Number, W:Number, H:Number, Roundness:Number, Thickness:Number, Tint:Number, Alpha:Number) {
      _root.createEmptyMovieClip("Rect", 1);
      _root.Rect.lineStyle(Thickness, Tint, Alpha, true, "none");
      _root.Rect.moveTo(X, Y + Roundness);
      _root.Rect.curveTo(X, Y, X + Roundness, Y);
      _root.Rect.lineTo(X + (W - Roundness), Y);
      _root.Rect.curveTo(X + W, Y, X + W, Y + Roundness);
      _root.Rect.lineTo(X + W, Y + (H - Roundness));
      _root.Rect.curveTo(X + W, Y + H, X + (W - Roundness), Y + H);
      _root.Rect.lineTo(X + Roundness, Y + H);
      _root.Rect.curveTo(X, Y + H, X, Y + (H - Roundness));
      _root.Rect.lineTo(X, Y + Roundness);
      }
      DrawRoundedRectangle(10, 10, 120, 90, 10, 1, 0x000000, 100);

      If I change it's _width or _height property unfortunately it's rounded corners grows too. And the other problem I don't understand: Why do the x and y coordinates of the rectangle change when I magnify it?