flash as3 场景上有一mc 要实现只能在Y轴上上下拖动并且只有500的拖动范围
mc1.addEventListener(MouseEvent.MOUSE_DOWN,fl_ClickToDrag);functionfl_ClickToDrag(eve...
mc1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
function fl_ClickToDrag(event:MouseEvent):void
{
mc1.startDrag(false,new Rectangle(mc1.x,mouseY));
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
function fl_ReleaseToDrop(event:MouseEvent):void
{
mc1.stopDrag();
}
我尝试着这样子写,虽然x轴固定不动了,但是Y轴无法实现拖动效果。只能让mc1.y一下子变到mc1元件范围内鼠标点击的y坐标
初学者求好心人help 展开
function fl_ClickToDrag(event:MouseEvent):void
{
mc1.startDrag(false,new Rectangle(mc1.x,mouseY));
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
function fl_ReleaseToDrop(event:MouseEvent):void
{
mc1.stopDrag();
}
我尝试着这样子写,虽然x轴固定不动了,但是Y轴无法实现拖动效果。只能让mc1.y一下子变到mc1元件范围内鼠标点击的y坐标
初学者求好心人help 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询