0

誰かが私を助けることができますか?、私はセノキュラー トランスフォーム ツール ライブラリを使用していますが、コンテナ内で移動を制限する必要があります。

たとえば、box1 (300x200) があり、この中に他の box2 (20x20) があります... box1 内の box2 のみを移動 (ドラッグ) できます。

Senocular トランスフォーム ツールは、「回転」、「サイズ変更」、および「移動」を使用してオブジェクトを駆動するためのライブラリです。 http://www.senocular.com/flash/tutorials/transformtool/

4

1 に答える 1

0

リスナーが mouseX と mouseY を追跡できるようにすることができます。

someObject.startDrag();
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove, false, 0, true);


private function handleMouseMove(event:MouseEvent = null):void {

//define an area
if (stage.mouseX < 20 || stage.mouseX > stage.stageWidth - 20 || stage.mouseY < 20 || stage.mouseY > stage.stageHeight - 20) {


//call stopDrag on your object or move it back somewhere.
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove);
someObject.stopDrag();

}

}
于 2012-05-31T14:50:39.913 に答える