私は親指という名前のMcを持っています。そして、私はトラックと名付けられた他のMCを持っています. 以下のスクリプトを使用して thumb_mc を移動すると、track_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);
}