Monday, 31 March 2008

Action Script 2: Vector Illustration Example

Interesting article on vector illustration in FLASH.
http://www.kirupa.com/developer/flashcs3/flash_vector_illustration.htm

Drawing LINES in AS2

this.createEmptyMovieClip("line_mc", 1);

with(line_mc){
lineStyle(5, 0x000000, 50, true, "normal", "square", "miter", 1);
moveTo(0, 0);
lineTo(150, 0);
_x=100;
_y=150;
}

Drawing CURVES in AS2

this.createEmptyMovieClip("circle_mc", 1);
with (circle_mc) {
beginFill(0xFF0000);
moveTo(100, 100);
curveTo(200,0,300,100);
curveTo(400,200,300,300);
curveTo(200,400,100,300);
curveTo(0,200,100,100);
endFill();
}

Drawing SHAPES in AS2

this.createEmptyMovieClip("square_mc", this.getNextHighestDepth());
square_mc.lineStyle(5, 0xff00ff, 100, true, "none", "round", "miter", 1);
square_mc.beginFill(0xFF0000);
square_mc.moveTo(10, 10);
square_mc.lineTo(100, 10);
square_mc.lineTo(100, 100);
square_mc.lineTo(10, 100);
square_mc.lineTo(10, 10);
square_mc.endFill();

No comments: