0

我正在用 Actionscript 2.0 开发一个项目。我有一个平移的图像。我遵循了本教程: http ://www.kirupa.com/developer/flash8/interactive_image_pan.htm

现在我希望图像在鼠标悬停在某个影片剪辑而不是整个舞台时平移。当鼠标悬停在影片剪辑的左边界时,图像会平移到该边界。像这个(除了我不想垂直平移): http ://www.oxylusflash.com/files/1027/index.html

有什么帮助吗??提前致谢

4

1 回答 1

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))); 

    }

}
于 2011-05-31T05:11:00.217 回答