Making a Line Tool? ie point to point

Hmmm, my code works for me :stuck_out_tongue:

And slow? The AS tag is new today, Kirupa just added it. So you’re not slow.

*Originally posted by lostinbeta *
**BTW Sen: What is up with your title? kuser2867? You replied to my PM with that too. Any special meaning? **

its just your vbul id number. Basically the number representing what user you are in chronological terms where 1 is the first person to sign up (kirupa) 2 being the second and so forth. You were the 634th person to sign up on kirupa so to the boards, thats how you are identified as an entity.

Your profile:


http://www.kirupaforum.com/forums/member.php?s=&action=getinfo&**userid=634**

Kirupas:


http://www.kirupaforum.com/forums/member.php?s=&action=getinfo&**userid=1**

Mine:


http://www.kirupaforum.com/forums/member.php?s=&action=getinfo&**userid=2867**

Theres a satiric humor involved in associating a emotionally associated personality or person through a industrial identification number.
:slight_smile:

Well hey there kuser286 & kuser634. :smirk: . Ive just been having a bit of fun with the GUI of the drawing app! Actually i remember a while ago when I first came to kirupa to look around it was a neat little site, but fkit still had more going on. It seems Kirupa is really building up eh? So you guys use other sites like Actionscript.orG ? A couple of the guys who are the moderators taught me at uni and none of them even come close to the explanations and help you two have given. Gees I remember when you Trev stayed up and gave me hand with part of a Uni assignement I was having troubles with early last year, cant repay your for that help,

Anyway cherry oh for now, kuser4006

*Originally posted by mindfriction *
Gees I remember when you Trev stayed up and gave me hand with part of a Uni assignement I was having troubles with early last year, cant repay your for that help

awesome :wink:

heres some more drawing stuff :slight_smile:


MovieClip.prototype.Circle = function(x,y, w,h, centered, lstyle, fstyle) {
	if (!centered){
		w /= 2; h /= 2;
		x += w; y += h;
	}
	var xc1 = w*(Math.SQRT2-1), xc2 = w*Math.SQRT2/2;
	var yc1 = h*(Math.SQRT2-1), yc2 = h*Math.SQRT2/2;
	if (lstyle) lineStyle.apply(this, lstyle);
	if (fstyle) beginFill.apply(this, fstyle);
	this.moveTo(x+w, y);
	this.curveTo(x+w, y+yc1, x+xc2, y+yc2);
	this.curveTo(x+xc1, y+h, x, y+h);
	this.curveTo(x-xc1, y+h, x-xc2, y+yc2);
	this.curveTo(x-w, y+yc1, x-w, y);
	this.curveTo(x-w, y-yc1, x-xc2, y-yc2);
	this.curveTo(x-xc1, y-h, x, y-h);
	this.curveTo(x+xc1, y-h, x+xc2, y-yc2);
	this.curveTo(x+w, y-yc1, x+w, y);
	this.endFill();
	return this;
};
MovieClip.prototype.Square = function(x,y, w,h, centered, lstyle, fstyle){
	if (!centered){
		w /= 2; h /= 2;
		x += w; y += h;
	}
	if (lstyle) lineStyle.apply(this, lstyle);
	if (fstyle) beginFill.apply(this, fstyle);
	this.moveTo(x-w, y-h);
	this.lineTo(x+w, y-h);
	this.lineTo(x+w, y+h);
	this.lineTo(x-w, y+h);
	this.lineTo(x-w, y-h);
	this.endFill();
	return this;
}

this.shapeList = ["No Tool", "Square","Circle"];
this.shapeList.pos = 0;
this.onMouseDown = function(){
	if (this.shape.onMouseMove) delete this.shape.onMouseMove;
	var tool = this.shapeList[this.shapeList.pos];
	if (this[tool]){
		var x = this._xmouse, y = this._ymouse;
		var centered = Key.isDown(Key.CONTROL)
		this.shape = this.createEmptyMovieClip("shape"+this.depth, this.depth++);
		this.shape.onMouseMove = function(){
			var w = this._parent._xmouse-x, h = this._parent._ymouse-y;
			if (Key.isDown(Key.SHIFT)) w = h = Math.max(Math.abs(w), Math.abs(h)); // if uniform scale
			this.clear();
			this[tool](x,y, w,h, centered, glstyle, gfstyle);
			updateAfterEvent();
		}
	}
}
this.onMouseUp = function(){
	delete this.shape.onMouseMove;
}
Key.addListener(this);
this.onKeyDown = function(){
	if (inc = Key.isDown(Key.UP) - Key.isDown(Key.DOWN)){
		this.shapeList.pos += inc;
		if (this.shapeList.pos >= this.shapeList.length) this.shapeList.pos = 0;
		else if (this.shapeList.pos < 0) this.shapeList.pos = this.shapeList.length - 1;
		trace(this.shapeList[this.shapeList.pos]);
	}
}
trace(this.shapeList[this.shapeList.pos] +" selected, Use the UP & Down keys to switch tools.
The CONTROL and SHIFT keys will toggle drawing styles.");
glstyle = [2,0,100];
gfstyle = [0xff,20];

I almost forgot to use [**as] !

heres two more additions (the basic line and simple curve) - figured they should be included


MovieClip.prototype.Line = function(x,y, w,h, centered, lstyle, fstyle){
	if (lstyle) lineStyle.apply(this, lstyle);
	this.moveTo(x, y);
	this.lineTo(x+w, y+h);
	return this;
}
MovieClip.prototype.BasicCurve = function(x,y, w,h, centered, lstyle, fstyle){
	if (lstyle) lineStyle.apply(this, lstyle);
	this.moveTo(x, y);
	var cx = x+w, cy = y;
	this.curveTo(cx, cy, x+w, y+h);
	return this;
}
this.shapeList = ["No Tool", "Square","Circle","Line","BasicCurve"];

heres something I made with these heh

*Originally posted by senocular *
**its just your vbul id number. Basically the number representing what user you are in chronological terms where 1 is the first person to sign up (kirupa) 2 being the second and so forth. You were the 634th person to sign up on kirupa so to the boards, thats how you are identified as an entity… **

sorry to barge in to this thread with an off topic reply, but i only want to tell you, sen, that these numbers are crazy. :crazy:

i registered on 10-21-2002 and received the number 17198
while you registered on 12-27-2002 and received the number 2867.
you´re more than two months newer than me and i have a digit more than you (-:

you’re just 1913 guig0 :slight_smile:

i´m saying that this boards are behaving strangely these days…

i´m 1913 now, but i was 17198 just an hour ago (-:

i got the date at the same place i got my number… the date was right, but why the number wasn´t… :-\

Excellent stuffs Sen.

It is hard to believe there were only 633 other members on this forum when I signed up. And a majority of those users had 0 posts :stuck_out_tongue: I guess I came here earlier than I though, makes me feel happy.

kuser634 :slight_smile:

hahah checked out your ‘derw.gif’ Sen, is that a self portrait? Im working on changing the cursor for the different tool modes, ie for for move/ resize. Just about to check kirupa for some tutes on changing cursor :slight_smile: