1
내가 캔버스에 표시되는 점의 집합이 이동 연결 : 다음 점들을 연결, 다른 점 (코드 키 비트 꺼냈다)
// Drop points based on x y coords
for (var i = 0; i < 50; i++) {
itemPoint[i] = new mcDot();
itemPoint[i].x = 500*Math.random();
itemPoint[i].y = 500*Math.random();
// Set up drag & drop
initDragger(itemPoint[i]);
itemPoint[i].buttonMode = true;
addChild(itemPoint[i]);
}
- 하나 점 50 개 연결
// Draw connections
for (i = 0; i < 50; i++) {
for (j = 0; j < 50; j++) {
// Is there a connection in the matrix?
if (connectMatrix[i][j] > 0) {
itemConnect[k] = new Shape();
itemConnect[k].graphics.lineStyle(1, 0x000000);
// Connect the line to the dots
itemConnect[k].graphics.moveTo(itemPoint[i].x, itemPoint[i].y);
itemConnect[k].graphics.lineTo(itemPoint[j].x, itemPoint[j].y);
addChild(itemConnect[k++]);
}
}
}
내가 드래그를 가지고 점에 대한 작업 드롭 할 수 : 그러나
/** Drag and drop functions */
function initDragger(mc:MovieClip):void {
mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
mc.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}
function mouseDownHandler(e:MouseEvent):void {
e.currentTarget.startDrag();
}
function mouseUpHandler(e:MouseEvent):void {
e.currentTarget.stopDrag();
}
을, 정말이야입니다 점을 옮길 때 선을 다시 그리는 방법을 생각해보십시오. 또한 단일 점에 연결된 많은 선이있을 수 있습니다. 어떤 점이 어떤 점에 연결되어 있는지 어떻게 든 등록해야합니까? 어떻게 이것을 기준으로 선을 수정합니까?
감사합니다.