我试图制造一些可移动的事例,这些事例是可分割的,而且有一条线连接它们,自动更新。
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);
谁能告诉我我,我会错了吗?
Thanks a lot of any help !!!!