# Script draw & record

**URL:** <https://forum.kirupa.com/t/script-draw-record/38822>\
**Category:** Uncategorized\
**Created:** [December 30, 2003, 6:38am UTC](https://forum.kirupa.com/t/script-draw-record/38822 "2003-12-30T06:38:16Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![hognav2t](https://avatars.discourse-cdn.com/v4/letter/h/eb8c5e/32.png) [@hognav2t](https://forum.kirupa.com/u/hognav2t)\
**Post date:** [December 30, 2003, 6:38am UTC](https://forum.kirupa.com/t/script-draw-record/38822/1 "2003-12-30T06:38:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 30, 2003, 6:41am UTC](https://forum.kirupa.com/t/script-draw-record/38822/2 "2003-12-30T06:41:33Z")

</div>

[http://24.141.60.208/drawer.fla](http://24.141.60.208/drawer.fla) 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 30, 2003, 6:44am UTC](https://forum.kirupa.com/t/script-draw-record/38822/3 "2003-12-30T06:44:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 30, 2003, 6:48am UTC](https://forum.kirupa.com/t/script-draw-record/38822/4 "2003-12-30T06:48:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 30, 2003, 6:55am UTC](https://forum.kirupa.com/t/script-draw-record/38822/5 "2003-12-30T06:55:34Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 30, 2003, 7:01am UTC](https://forum.kirupa.com/t/script-draw-record/38822/6 "2003-12-30T07:01:11Z")

</div>

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 !!~~

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 30, 2003, 9:37am UTC](https://forum.kirupa.com/t/script-draw-record/38822/7 "2003-12-30T09:37:16Z")

</div>

```auto

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:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 30, 2003, 10:17am UTC](https://forum.kirupa.com/t/script-draw-record/38822/8 "2003-12-30T10:17:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 30, 2003, 11:54am UTC](https://forum.kirupa.com/t/script-draw-record/38822/9 "2003-12-30T11:54:36Z")

</div>

i got bored  
[http://kirupa.rastardesigns.com/gap\_lines.html](http://kirupa.rastardesigns.com/gap_lines.html)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 30, 2003, 3:20pm UTC](https://forum.kirupa.com/t/script-draw-record/38822/10 "2003-12-30T15:20:08Z")

</div>

thnx alot guys! much appreciated

hog !!~~
