Tony Polinelli
Tarwin Stroh-Spijer

contact [at]

6/25 Easey Street
Collingwood, 3066
Vic, Australia

+61 3 8060 5321

Posts Tagged ‘as3 drawing’

Friday, April 25th, 2008

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!

Our Friends:

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