S R R
S R R

Reputation: 61

How to draw dashed line in ActionScript 2?

I want to draw dashed line in Swish Max (ActionScript 2). I use this code but it created a solid red line.

_root.createEmptyMovieClip("myclip",1);
myclip.clear();
myclip.lineStyle(2,0xFF0000,100);
myclip.moveTo(100, 100);
myclip.lineTo(200, 200);

How to change it to draw a dashed line?

Upvotes: 1

Views: 482

Answers (1)

nullheart
nullheart

Reputation: 41

If you could use AS3, then here's your answer: http://andywoodruff.com/blog/drawing-dashed-lines-with-actionscript-3/ If you have to use AS2, then the idea is as follows: draw a line -> make a gap -> repeat until desired length is achieved. The trick comes when drawing them diagonally, but it's still doable with proper calculations.

Upvotes: 2

Related Questions