1 Reply Latest reply on Apr 7, 2007 3:38 AM by Newsgroup_User

    drawBox with round corners?

    reinhat Level 1
      If I use the drawBox function, how can make the corners round?
      I want to set all the corner radiuses of the dynamically created box to 6 pixels.
      Maybe later I need to set the corner radius to a different number.
      How can I achieve this with scripting?
      thanks Attila
        • 1. Re: drawBox with round corners?
          Level 7
          I believe you'll need to use the drawing API - check out the moveTo, lineTo,
          and curveTo methods.
          It's pretty easy really - here's a function to get you started:

          function doBox(xLoc, yLoc, wide, high, radius) {
          box.lineStyle(2, 0x000000, 100);
          box.moveTo(xLoc, yLoc + radius);
          box.curveTo(xLoc, yLoc, xLoc + radius, yLoc);
          box.lineTo(xLoc + (wide - radius), yLoc);
          box.curveTo(xLoc + wide, yLoc, xLoc + wide, yLoc + radius);
          box.lineTo(xLoc + wide, yLoc + (high - radius));
          box.curveTo(xLoc + wide, yLoc + high, xLoc + (wide - radius), yLoc + high);
          box.lineTo(xLoc + radius, yLoc + high);
          box.curveTo(xLoc, yLoc + high, xLoc, yLoc + (high - radius));
          box.lineTo(xLoc, yLoc + radius);

          This, of course, assumes there's an empty clip named 'box' available to draw

          Dave -
          Head Developer
          Adobe Community Expert