8-bit mate
8-bit mate

Reputation: 85

Line going from one instance to the other

lets say I have a library object (node1) which i have instantiated twice (mc1 & mc2) in two different random positions that may and probably change when the program runs. How can I create a line that will automatically go from one instance's position to the other? Code example will be very nice.

ANY answer is highly appreciated!

Upvotes: 0

Views: 49

Answers (1)

laurent
laurent

Reputation: 90863

Just have a sprite over or below the two movie clips, then use Graphics.moveTo / Graphics.lineTo to draw the line:

var g:Graphics = someSprite.graphics;
g.lineStyle(1, 0x000000);
g.graphics.moveTo(mc1.x, mc1.y);
g.graphics.lineTo(mc2.x, mc2.y);

Upvotes: 2

Related Questions