Tony Polinelli
Tarwin Stroh-Spijer

contact [at]

6/25 Easey Street
Collingwood, 3066
Vic, Australia

+61 3 8060 5321

AS2 + AS3 Draw a Dotted Rounded Corner Box

So you might think that rounded corners is easy in as3 with the new drawing tools. This is only so true if you don't want it dotted.

Thanks to senocular AS2 which was easily converted to an as3 version for as3 we can draw dotted lines and curves with actionscript. This left me with the task of using the quadratic drawing tools (no i didnt add a cubic curveTo to the Dashed line class) to draw circles (or quarters of circles, for the curners), which isnt the easiest, but i'll spare you the details and simply say, its done!

Using Draw.curvedBox(obj, offsetX, offsetY, width, height, cornerRadius) we can draw into any graphics object (whether it be a normal or a DashedLine Object). This is essential as the Dashed line tool doesnt actually give us a fill, so we might need to draw a normal shape for the background.

  1. import com.senocular.drawing.DashedLine
  2. import com.tonp.utils.Draw
  3. var dl = new DashedLine(this,1,5);
  4. dl.lineStyle(3,0x000000,1);
  5. Draw.curvedBox(dl,10,10,100,100,20)

to draw a curved corner box with a fill, or solid outline, send in as the first attribute (or just the mc in as2)

So we can now do a box with curved corners in either AS2 or AS3 and in dotted or normal... phew!



  1. jacek

    thanks a million, friend!

    exactly what I was looking for.

  2. This might possibly be exactly what I'm looking for!

    Is there a source file or an example uploaded so I can see how this works?

  3. The source files are in the article, the linked "as" files. For as3 they need to be imported as in the example above and should then work out of the box.

  4. Cheers mate that was exactly what I needed but couldn't be bothered to write! Great class.

  5. saravana raja


    Below is the code i tried for testing. but i see nothing working.
    pls tell me what i am missing.

    import com.senocular.drawing.DashedLine;
    var shp:Shape = new Shape();
    var myDashedDrawing:DashedLine = new DashedLine(shp, 10, 5);
    myDashedDrawing.moveTo(50, 50);
    myDashedDrawing.lineTo(100, 50);
    myDashedDrawing.lineTo(100, 100);
    myDashedDrawing.lineTo(50, 100);
    myDashedDrawing.lineTo(50, 50);

  6. Hey is this component pubished under the WTFPL (Do What The Fuck You Want To Public License) License? see

  7. Kamil Waheed

    Just what I needed. Thanks alot!!


Leave a Reply

Our Friends:

Powered by haXe / poko cms | Copyright 2008-09 TouchMyPixel