I am trying to create to movable instances, that are draggable, and which have a line connecting them which updates automatically.
The thing is: The original line just goes randomly and doesn't update as the instances (mc1, mc2) are being dragged. Here is the code I have got so far:
mc1.addEventListener(MouseEvent.MOUSE_DOWN, function (e:MouseEvent):void
{
e.currentTarget.startDrag();
});
mc1.addEventListener(MouseEvent.MOUSE_UP, function (e:MouseEvent):void
{
e.currentTarget.stopDrag();
});
mc2.addEventListener(MouseEvent.MOUSE_DOWN, function (e:MouseEvent):void
{
e.currentTarget.startDrag();
});
mc2.addEventListener(MouseEvent.MOUSE_UP, function (e:MouseEvent):void
{
e.currentTarget.stopDrag();
});
var mc:MovieClip = new MovieClip();
mc.graphics.beginFill(0x000000);
mc.graphics.lineStyle(2,0x000000);
//start drawing the line
mc.graphics.moveTo(mc1.x,mc1.y);
mc.graphics.lineTo(mc2.x,mc2.y);
mc.graphics.endFill();
//Position your new movie clip
addChild(mc);
Can anyone tell me where have I got it wrong?
Thanks a lot of any help !!!!