Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are two ways to draw circles in the Starling framework:

METHOD 1: Using the Graphics class

Step 1: Create a new instance of the Graphics class.

var circle:Shape = new Shape();

Step 2: Start drawing the circle using the beginFill method.

circle.graphics.beginFill(0xFF0000); // Red color

Step 3: Draw the circle using the drawCircle method.

circle.graphics.drawCircle(50, 50, 25); // (x, y, radius)

Step 4: End the fill using the endFill method.

circle.graphics.endFill();

Step 5: Add the circle to the display list.

addChild(circle);

METHOD 2: Using the Circle class

Step 1: Create a new instance of the Circle class.

var circle:Circle = new Circle(25, 0xFF0000); // (radius, color)

Step 2: Set the position of the circle.

circle.x = 50;
circle.y = 50;

Step 3: Add the circle to the display list.

addChild(circle);