Quantunet.com

My Account

Joins Us
Flash 8 Actionscript 2.0 Knowledgebase
Drawing A Rectangle II (Using A Custom Function)  

Download .fla

How to draw this rectangle with Actionscript.

Actionscript

this.createEmptyMovieClip("my_rectangle_mc", 1);
my_rectangle_mc._x = 75;
my_rectangle_mc._y = 75;

drawRectangle(my_rectangle_mc, 240, 180, 4, 0x999999, 100, 0xFF99FF, 100);

function drawRectangle(target_mc:MovieClip, boxWidth:Number, boxHeight:Number, lineHeight:Number, lineColor:Number, lineAplha:Number, fillColor:Number, fillAlpha:Number):Void {
with (target_mc) {
beginFill(fillColor, fillAlpha);
lineStyle(lineHeight,lineColor,lineAplha);
moveTo(0, 0);
lineTo(boxWidth, 0);
lineTo(boxWidth ,boxHeight);
lineTo(0, boxHeight);
lineTo(0, 0);
endFill();
}
}


How The Actionscript Works





© 2008 Quantunet LLC All Rights Reserved | Intellectual Property | Terms of Use | Privacy
Home | About Quantunet | FAQ's | Contact Us