4 Replies Latest reply on May 30, 2007 9:22 AM by kglad

# drawing a line from one nested MC to another

I'm using the Drawing API to draw a line from one MC nested within two levels of parent MCs to another similarly-nested MC. Can someone tell me how to get the X,Y coordinates of both points?
• ###### 1. Re: drawing a line from one nested MC to another
that's too much typing. if gp=grandparent, p=parent, c=child, use:

• ###### 2. Re: drawing a line from one nested MC to another
Try this:

var objPointA:Object = new Object()
var objPointB:Object = new Object()

objPointA.x = grandparentA_mc.parentA_mc.childA_mc._x;
objPointA.y = grandparentA_mc.parentA_mc.childA_mc._y;
objPointB.x = grandparentB_mc.parentB_mc.childB_mc._x;
objPointB.y = grandparentB_mc.parentB_mc.childB_mc._y;

grandparentA_mc.parentA_mc.localToGlobal(objPointA);
grandparentB_mc.parentB_mc.localToGlobal(objPointB);

var lineHolder = _root.createEmptyMovieClip("lineHolder", 1);

lineHolder.lineStyle(1, clr, 100);
lineHolder.moveTo(objPointA.x, objPointA.y);
lineHolder.lineTo(objPointB.x, objPointB.y);

--
-------------------------------
Remove '_spamkiller_' to mail
-------------------------------

• ###### 3. Re: drawing a line from one nested MC to another
Thanks again kglad. Here's the rub, though. I also have one of the grandparent MCs dynamically scaling, which offsets the mark point A's. How do I work in the scale factor?
• ###### 4. Re: drawing a line from one nested MC to another
use peter's code. i think that's a better solution and will have no problem with scaling.