sample code:
ball1.buttonMode = true;
ball2.buttonMode = true;
ball1.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
ball1.addEventListener(MouseEvent.MOUSE_UP, onUp);
ball1.addEventListener(MouseEvent.MOUSE_MOVE, onMove);
ball2.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
ball2.addEventListener(MouseEvent.MOUSE_UP, onUp);
function onDown(e:MouseEvent):void
{
e.currentTarget.startDrag();
}
function onUp(e:MouseEvent):void
{
e.currentTarget.stopDrag();
}
function onMove(e:MouseEvent):void
{
e.updateAfterEvent();
}
沒有留言:
張貼留言