Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Bryan Gidge http://www.gidge.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Actionscript Draw Box

Function to draw a box with a specified width, height, and color, and return the box MovieClip

function draw_box(w,h,c){
	var new_box = this.createEmptyMovieClip("new_box", this.getNextDepth());
	new_box.beginFill(c);
	new_box.lineStyle(0,0x000000,0);
	new_box.moveTo(0, 0);
	new_box.lineTo(w, 0);
	new_box.lineTo(w, h);
	new_box.lineTo(0, h);
	new_box.lineTo(0, 0);
	new_box.endFill();
	return new_box;
}



Sample function call draws a 200w x 25h pixel, black box:
draw_box(200,25,0x000000);
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS