.shivanshi.
. Home . Share . Share Success . Join Us! .

ActionScript - Code Samples

Drawing API

These are the main methods to create movieclip and drawing:

// DYNAMICALLY DRAW A RECTANGLE --
// This function being defined as a prototype method, can be used with 
// any movieclip 
MovieClip.prototype.drawRectangle = function(w, h) {
	var s:MovieClip = this.createEmptyMovieClip("s1", 1);
	s.beginFill(0xff0000, 100);
	s.moveTo(0, 0);
	s.lineTo(w, 0);
	s.lineTo(w, h);
	s.lineTo(0, h);
	s.endFill();
};
// Create a new movieclip inside which you want to draw the rectangle
this.createEmptyMovieClip("x", 1);
// Call the method to draw rectangle with width and height as parameters
x.drawRectangle(200, 100);
Add Favorite
| About Us | Site Map | Privacy Policy | Contact Us |
.shivanshi.