Welcome to my actionscript snippet library!

Actionscript Snips is a small repository of actionscript code that aims to save developers and designers time when developing a website.  

Draw A Circle


var circle:Shape;

drawCircle(100, 100, 75, 0xFF0000);

function drawCircle(x:Number, y:Number, radius:Number, color:uint){
circle = new Shape;
circle.graphics.beginFill(color);
circle.graphics.drawCircle(x, y, radius);
circle.graphics.endFill();
addChild(circle);
}

Draw A Rectangle


var rectangle:Shape;

drawRectangle(0, 0, 200, 200, 0x0000FF); //Draws a rectangle at the origin

function drawRectangle(x:Number, y:Number, width:Number, height:Number, color:uint){
rectangle = new Shape;
rectangle.graphics.beginFill(color);
rectangle.graphics.drawRect(x, y, width, height);
rectangle.graphics.endFill();
addChild(rectangle);
}