Script draw & record

het guys,

any 1 know how 2 sript:

to draw a line ( 4 example ) frm point A to point B

and then code it such that the viewer can see the

line being drawn ?

thnx tons !!~~

i got the drawing part dwn, just need the recording part.

http://24.141.60.208/drawer.fla :slight_smile:

thnx 4 that ahmed. actually i was kinda lookin 4 more

of a hands-free situation.

so, when u test the movie, a line will start drawing until it

reaches its destination point.

i’ll check out the code in the meantime and c if i can extract
anythin frm it though.

nevermind what i wrote; i didnt check out the whole movie.

you could draw whatever you’re trying to have the movie draw, trace the array where the coordinates are logged, then have these pre-stored into the movie, and get the movie to draw the image :slight_smile:

thx 4 ur help, im quite new 2 as and it’d help me alot

if u can write what u just said for a simple 2 point straight line

script.

thnx

hog !!~~


MovieClip.prototype.createLine = function(x2, y2, speed) {
	this.lineStyle(0, 0xFF0000, 100);
	this.moveTo(0, 0);
	speed = (speed <= 0 || speed == undefined) ? 1 : Math.round(speed);
	this.xInc = x2/speed;
	this.yInc = y2/speed;
	this.currentX = 0;
	this.currentY = 0;
	this.onEnterFrame = function() {
		if (this.currentX != x2) {
			trace("draw:" + this.currentX);
			this.currentX += this.xInc;
			this.currentY += this.yInc;
			this.lineTo(this.currentX, this.currentY);
		} else {
			delete this.onEnterFrame;
		}
	};
};
MovieClip.prototype.drawLine = function(lineName, x1, y1, x2, y2, speed) {
	if (lineName != undefined && !this[lineName]) {
		this.dep = (dep == undefined) ? 1 : dep + 1;
		this.createEmptyMovieClip(lineName, dep);
		this[lineName]._x = x1;
		this[lineName]._y = y1;
		this[lineName].createLine(x2 - x1, y2 - y1, speed);
	}
};
_root.drawLine("line3", 50, 50, 0, 0, 200);
//speed = number of frames to draw line

edit: i had my random function in there for the color, oops. :beam:

lol thanks for helping him out norie, the drawer.fla file is pretty old, the code i had in there is pretty sloppy :slight_smile:

i got bored
http://kirupa.rastardesigns.com/gap_lines.html

thnx alot guys! much appreciated

hog !!~~