图像平移区域

时间:2011-05-16 14:04:34

标签: flash actionscript-2 panning

我正在使用Actionscript 2.0开发一个项目。我有一个平底锅的图像。我按照本教程: http://www.kirupa.com/developer/flash8/interactive_image_pan.htm

现在我希望图像在鼠标悬停一些movieclip而不是整个舞台时平移。当鼠标悬停在动画片段的左边界时,图像会平移到该限制。像这样(除了我不想垂直平移): http://www.oxylusflash.com/files/1027/index.html

任何帮助? 提前致谢

1 个答案:

答案 0 :(得分:0)

这需要一些工作,但你想要的基本想法是:

//horizontal panning only 

initial_x = myImage._x;

myImage.onRollOver = function() { 

    startPanning = 1; //starts panning when the mouse rolls over the image

}

myBorder.onRollOver = function() {

    startPanning = 0; 
//stops panning when the mouse rolls over the border
//the border that's ontop of the image 
//(like the one in your example) 
//this way the mouse can roll off the image 
//and only part of the image is shown at one time
//the rest is hidden by the border. 

}

myImage.onEnterFrame = function() {

    if (startPanning == 1) {

        myImage._x = (initial_x-((_xmouse)-(initial_x))); 

    }

}