Skip to main content
Participant
December 20, 2006
Question

Dotted Lines as outline for dynamically created shapes?

  • December 20, 2006
  • 2 replies
  • 223 views
Hey all, I'm building a site whose flat, vector shapes need an outline of a dotted line.

The majority of these shapes are simply rectangles with rounded corners. All are created dynamically.

I could do each shape's lines by hand and attach them, but I'd much rather use a script. Anyone have any suggestions? 🙂 I could use a good jump-start on tackling this.

Thanks in advance -
andy
This topic has been closed for replies.

2 replies

Inspiring
December 21, 2006
Yeah I agree, this is not an easy task. However senocular has a package that you can download that will get you pretty close to your goal. So if you download the zip here;

http://www.senocular.com/flash/source.php?id=0.159

…and comment out and modify the code in the fla as the following;

import com.senocular.drawing.*;

// create ProgressiveDrawing instance to draw in _root
//var myDrawing:ProgressiveDrawing = new ProgressiveDrawing(_root);

// create DashedLine instance to draw in myDrawing (ProgressiveDrawing)
// use random dash sizes
var myDash:DashedLine = new DashedLine(this, 35, 35);

// reset linestyle to random size and color
myDash.clear();
myDash.lineStyle(5, 0xFF0000, 100);

// draw a circle in the myDash instance
circle(myDash, 150,150, 200,200, true);

// because all myDash drawings were added to myDrawing,
// myDrawing will draw a dashed circle when draw is called
//myDrawing.draw(100);

…this will create a constant circle with a dashed line versus creating a random circle. You can obviously change the values on that frame which will change the color and spacing between the dashes (and a few other parameters will change others). If you notice the circle(), this is created also on the first frame but on a different layer. This is where you would want to change your shapes. Just create another layer that will contain a different shape. I hope this helps, regardless have a high regard for senocular and other developers that contributed to this package.
kglad
Community Expert
Community Expert
December 21, 2006
if you're attaching rectangles created in the authoring environment, create them with a dotted border. if you're creating your rectangles with the drawing api (with rounded corners), i don't see an easy way to draw dotted rounded corners.