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

   1  
   2  function draw_box(w,h,c){
   3  	var new_box = this.createEmptyMovieClip("new_box", this.getNextDepth());
   4  	new_box.beginFill(c);
   5  	new_box.lineStyle(0,0x000000,0);
   6  	new_box.moveTo(0, 0);
   7  	new_box.lineTo(w, 0);
   8  	new_box.lineTo(w, h);
   9  	new_box.lineTo(0, h);
  10  	new_box.lineTo(0, 0);
  11  	new_box.endFill();
  12  	return new_box;
  13  }
  14  


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