注册点与拖动边界框无关。
例如
new Rectangle(0,0,100,100)
仅允许 MovieCLip 仅从舞台左上角的 0,0 移动到 100,100。
[编辑]
boundingBox.graphics.moveTo(0,0);
boundingBox.graphics.beginFill(0);
boundingBox.graphics.lineTo(400,0);
boundingBox.graphics.lineTo(400,400);
boundingBox.graphics.lineTo(0,400);
boundingBox.graphics.lineTo(0,0);
boundingBox.graphics.endFill();
boundingBox.x = 100;
boundingBox.y = 100;
dragTarget.graphics.moveTo(0,0);
dragTarget.graphics.beginFill(0xff0000);
dragTarget.graphics.drawRect(0,0,10,10);
dragTarget.graphics.endFill();
dragTarget.x = 150;
dragTarget.y = 150;
container.addChild(boundingBox)
container.addChild(dragTarget)
this.addChild(container)
dragTarget.addEventListener(MouseEvent.MOUSE_DOWN,onDown)
var boundingBox:Sprite = new Sprite();
var dragTarget:Sprite = new Sprite();
var container:Sprite = new Sprite()
function onDown(event:Event):void{
var bounds:Rectangle = new Rectangle(boundingBox.x,
boundingBox.y,
boundingBox.width-dragTarget.width,
boundingBox.height-dragTarget.height)
dragTarget.startDrag( false,bounds )
}