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 DashedLine.as which was easily converted to an as3 version DashedLine.as 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 Sprite.graphics 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.
var dl = new DashedLine(this,1,5);
to draw a curved corner box with a fill, or solid outline, send in mc.graphics 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!
Tags: as3 drawing
This entry was posted on Friday, April 25th, 2008 at 2:18 am and is filed under Flash. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
August 2nd, 2008 at 10:31 pm
thanks a million, friend!
exactly what I was looking for.
March 27th, 2009 at 5:51 pm
Below is the code i tried for testing. but i see nothing working.
pls tell me what i am missing.
var shp:Shape = new Shape();
var myDashedDrawing:DashedLine = new DashedLine(shp, 10, 5);
August 11th, 2011 at 6:20 pm
Just what I needed. Thanks alot!!