Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using Actionscript 3 Dawing API to create a circular band (not a basic circle)

Explorer ,
Apr 04, 2021 Apr 04, 2021

Can someone show me the script (or method) for producing circular bands in AS3?

131
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 05, 2021 Apr 05, 2021
LATEST

Hi.

 

You can create a shape instance, draw 3 strokes in sequence, and then add the shape to the display list. Like this:

import flash.display.Shape;

var strokeColor:uint = 0x000000;
var strokeColor1:uint = 0xA6A6A6;
var shape:Shape = new Shape();

// inner stroke
shape.graphics.lineStyle(2, strokeColor);
shape.graphics.drawCircle(0, 0, 120);
shape.graphics.endFill();

// middle stroke
shape.graphics.lineStyle(34, strokeColor1);
shape.graphics.drawCircle(0, 0, 138);
shape.graphics.endFill();

// outer stroke
shape.graphics.lineStyle(2, strokeColor);
shape.graphics.drawCircle(0, 0, 156);
shape.graphics.endFill();

shape.x = stage.stageWidth * 0.5;
shape.y = stage.stageHeight * 0.5;

addChild(shape);

 

I hope it helps.

 

Regards,

JC

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines