나는 엄지라는 이름의 Mc가 있습니다. 그리고 저는 다른 트랙을 트랙으로지었습니다. 아래 스크립트를 사용하여 thumb_mc를 움직일 때 track_mc가 필요합니다.다른 mc가 as3으로 이동하는 동안 mc를 이동하는 방법
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumb_onMouseDown);
function thumb_onMouseDown(event:MouseEvent):void {
xOffset = mouseX - thumb.x;
stage.addEventListener(MouseEvent.MOUSE_MOVE, stage_onMouseMove);
stage.addEventListener(MouseEvent.MOUSE_UP, stage_onMouseUp);
}
function stage_onMouseMove(event:MouseEvent):void {
thumb.x = mouseX - xOffset;
//restrict the movement of the thumb:
if(thumb.x < 8) {
thumb.x = 8;
}
if(thumb.x > 540) {
thumb.x = 540;
}
event.updateAfterEvent();
}
function stage_onMouseUp(event:MouseEvent):void {
stage.removeEventListener(MouseEvent.MOUSE_MOVE, stage_onMouseMove);
stage.removeEventListener(MouseEvent.MOUSE_UP, stage_onMouseUp);
}
내가 여기에 어떤 Y 값을 돈 내 코드. . 스크롤 바처럼 오른쪽에서 왼쪽으로, 왼쪽에서 오른쪽으로 움직일 필요가 있습니다. 그리고 나는 마우스로 한번의 클릭으로 움직일 필요가있다. – Venki
어쨌든 나는 내 대답을 약간 업데이트했다. 도움이되는지 확인해 보라. – jfgi
괜찮은지 확인하자. 감사. – Venki