AS3平移多个MovieClips

时间:2014-07-11 15:07:58

标签: actionscript-3 flash

我正在平移背景但是我无法平移那个背景上的电影剪辑无论如何我可以平移多个电影剪辑?目前我有一些看起来像这样的东西 平移单个Movie Clip如何平移多个Movie Clips?

world.addEventListener(MouseEvent.MOUSE_DOWN, beginPan, false, 0, true); 

function beginPan(e:MouseEvent):void
{    
    deltaX = mouseX - world.x;            
    deltaY = mouseY - world.y;

    addEventListener(Event.ENTER_FRAME, doPan, false, 0, true);
    stage.addEventListener(MouseEvent.MOUSE_UP, endPan, false, 0, true);
}

function doPan(e:Event):void
{
    var curX:int = mouseX - deltaX;
    var curY:int = mouseY - deltaY;

   world.x = curX;
    world.y = curY;

}


function endPan(e:MouseEvent):void
{
    stage.removeEventListener(MouseEvent.MOUSE_UP, endPan);
    removeEventListener(Event.ENTER_FRAME, doPan);
}

0 个答案:

没有答案