flash as3鼠标拖拉代码这么写

如,我要按住鼠标拖拉一个物体到另一个位置,这么写呢?

第1个回答  2011-11-09
mc是你要拖动元件的名字。
mc.addEventListener(MouseEvent.MOUSE_DOWN,StartDragEvent);
mc.addEventListener(MouseEvent.MOUSE_UP,StopDragEvent);
function StartDragEvent(e:MouseEvent):void
{
var obj:Object=e.currentTarget;
obj.startDrag();
}
function StopDragEvent(e:MouseEvent):void
{
var obj:Object=e.currentTarget;
obj.stopDrag();
}

flash as3鼠标拖拉代码这么写
mc是你要拖动元件的名字。mc.addEventListener(MouseEvent.MOUSE_DOWN,StartDragEvent);mc.addEventListener(MouseEvent.MOUSE_UP,StopDragEvent);function StartDragEvent(e:MouseEvent):void { var obj:Object=e.currentTarget;obj.startDrag();} function StopDragEvent(e:MouseEvent):void { var obj:O...

相似回答
大家正在搜