View Full Version : Connect MC's using AS
How could I use AS to draw a line from 1 mc to another mc?
Thanks in advance. I'm just curious. I'm almost sure of how to do it.
magcius
09-08-2006, 06:56 PM
Do the MC's have a width or height? If so, where do you want the offset. Do you want it from one corner to another, or in the center?
Basic code for you to start out with is:
// Put this on your _root.
var tMC1:MovieClip = ThePathToMovieClip1;
var tMC2:MovieClip = ThePathToMovieClip2;
_root.lineStyle(0x000000, 100);
_root.lineTo(tMC1._x, tMC1._y, tMC2._x, tMC2._y);
Where your line is drawn relative to the MovieClips depends on where the "center" of the MovieClip is. The center is the little crosshair on and in the MovieClip.
Thanks so much. I'll try it out. I knew it wasn't too hard. That looks perfect. I should beable to edit it to my needs.
edit:I did it a little diffently but ty it works!
I did it like this.
_root.lineStyle(3, 0x000000);
_root.moveTo(_root.m2._x, _root.m2._y);
_root.lineTo(_root.m1._x, _root.m1._y);
magcius
09-08-2006, 09:39 PM
Oh yeah, my bad.
vBulletin® v3.7.3, Copyright ©2000-2010, Jelsoft Enterprises Ltd.