Skip to main content
Participant
April 4, 2021
Question

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

  • April 4, 2021
  • 1 reply
  • 161 views

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

    This topic has been closed for replies.

    1 reply

    JoãoCésar17023019
    Community Expert
    Community Expert
    April 5, 2021

    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