The following code draws basic shapes, colours them and positions them on the stage. Similar to using Java Swing, when you create a new GUI element, it must be added.

Compared to Java, the variable declaration is looser than Java which requires the programmer to declare the data type for a variable (int, long, char etc). ActionScript3, like
JavaScript, declares variables with var instead.

As you can see, each new instance of class Sprite has a unique name (square, rect, circle). These can be whatever you like. I commented the first shape for your reference, followed with two more shapes.

//This import was done automatically when I created the first Sprite

import flash.display.Sprite;

var square:Sprite = new Sprite();

/*first lineStyle digit controls thickness of the
line the second value is the line colour.*/,0×000000);

//the fill colour;

//create the shape dimensions,0,150,100);

//end the fill;

/*position on stage, see following objects for other
versions of this*/

square.x = stage.stageWidth/2-square.width/2;
square.y = stage.stageHeight/2-square.height/2;


var rect:Sprite = new Sprite();
rect.x = 10;
rect.y = -70;


var circle:Sprite = new Sprite();
circle.x = 100;
circle.y = 200;

Thanks to for fantastic tutorials and code commenting!