7 Replies Latest reply on Jun 15, 2007 6:46 AM by Swirlsky

    Rounded rectangle by ActionScript

    Swirlsky Level 1
      Hello,

      If I draw a rounded rectangle using ActionScript it's corners won't be as nice as the same rectangle's corners that I draw using the toolbar. You can see it on this image.

      The script that creates the rectangle is the following:

      import flash.geom.Rectangle;
      import flash.geom.Matrix;
      this.createEmptyMovieClip("my_mc", 1);
      var grid:Rectangle = new Rectangle();
      my_mc.scale9Grid = grid;

      my_mc._x = 50;
      my_mc._y = 50;

      var cornerRadius:Number = 5;
      var boxWidth:Number = 120;
      var boxHeight:Number = 90;

      my_mc.lineStyle(1, 0x503C46, 100);
      my_mc.moveTo(cornerRadius, 0);
      my_mc.lineTo(boxWidth - cornerRadius, 0);
      my_mc.curveTo(boxWidth, 0, boxWidth, cornerRadius);
      my_mc.lineTo(boxWidth, cornerRadius);
      my_mc.lineTo(boxWidth, boxHeight - cornerRadius);
      my_mc.curveTo(boxWidth, boxHeight, boxWidth - cornerRadius, boxHeight);
      my_mc.lineTo(boxWidth - cornerRadius, boxHeight);
      my_mc.lineTo(cornerRadius, boxHeight);
      my_mc.curveTo(0, boxHeight, 0, boxHeight - cornerRadius);
      my_mc.lineTo(0, boxHeight - cornerRadius);
      my_mc.lineTo(0, cornerRadius);
      my_mc.curveTo(0, 0, cornerRadius, 0);
      my_mc.lineTo(cornerRadius, 0);


      How could I draw better quality corners?