Как нарисовать пунктирную линию?

Всем доброго времени суток!

Не подскажете, как можно нарисовать пунктирную линию? Например, вот такой код:

               
this.graphics.beginFill (0xffffff, 0);
this.graphics.lineStyle (1, 0x000000, 10, flash.display.LineScaleMode.NONE);
this.graphics.drawCircle (0, 0, 20);
this.graphics.endFill;

И хочется, чтобы контур был пунктирным.

Заранее спасибо!

Вот код Рика

Вот код Рика Ивинга на AS2.0:

/*-------------------------------------------------------------
mc.dashTo is a metod for drawing dashed (and dotted)
lines. I made this to extend the lineTo function because it
doesnХt have the cutom line types that the in program
line tool has. To make a dotted line, specify a dash length
between .5 and 1.
-------------------------------------------------------------*/
MovieClip.prototype.dashTo = function(startx, starty, endx, endy, len, gap) {
// ==============
// mc.dashTo() - by Ric Ewing (ric@formequalsfunction.com) - version 1.2 - 5.3.2002
//
// startx, starty = beginning of dashed line
// endx, endy = end of dashed line
// len = length of dash
// gap = length of gap between dashes
// ==============
//
// if too few arguments, bail
if (arguments.length < 6) {
return false;
}
// init vars
var seglength, deltax, deltay, segs, cx, cy;
// calculate the legnth of a segment
seglength = len + gap;
// calculate the length of the dashed line
deltax = endx - startx;
deltay = endy - starty;
delta = Math.sqrt((deltax * deltax) + (deltay * deltay));
// calculate the number of segments needed
segs = Math.floor(Math.abs(delta / seglength));
// get the angle of the line in radians
radians = Math.atan2(deltay,deltax);
// start the line here
cx = startx;
cy = starty;
// add these to cx, cy to get next seg start
deltax = Math.cos(radians)*seglength;
deltay = Math.sin(radians)*seglength;
// loop through each seg
for (var n = 0; n < segs; n++) {
this.moveTo(cx,cy);
this.lineTo(cx+Math.cos(radians)*len,cy+Math.sin(radians)*len);
cx += deltax;
cy += deltay;
}
// handle last segment as it is likely to be partial
this.moveTo(cx,cy);
delta = Math.sqrt((endx-cx)*(endx-cx)+(endy-cy)*(endy-cy));
if(delta>len){
// segment ends in the gap, so draw a full dash
this.lineTo(cx+Math.cos(radians)*len,cy+Math.sin(radians)*len);
} else if(delta>0) {
// segment is shorter than dash so only draw what is needed
this.lineTo(cx+Math.cos(radians)*delta,cy+Math.sin(radians)*delta);
}
// move the pen to the end position
this.moveTo(endx,endy);
};

Переделай под haxe, это несложно

Настройки просмотра комментариев

Выберите нужный метод показа комментариев и нажмите "Сохранить установки".

Отправить комментарий

Содержание этого поля является приватным и не предназначено к показу.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <blockcode> <dd>
  • Строки и параграфы переносятся автоматически.
  • Адреса страниц и электронной почты автоматически преобразуются в ссылки.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>.

Подробнее о форматировании

CAPTCHA
Этот вопрос помогает предотвратить автоматический спам
Image CAPTCHA
Enter the characters shown in the image without spaces, also respect upper and lower case.
To prevent automated spam submissions leave this field empty.