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 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);
}

0 comments:

Post a Comment