帮助!!
我在 mc 上有一段代码,当鼠标被拖动时,它会播放该影片剪辑,从而实现产品的 360 度旋转。
在这个关于 360 度旋转的不同增量的影片剪辑中,我有与产品的每个角度相关的各种其他动画的子影片剪辑。
经验..
场景 1 > spinY_mc > AWComplete_mc
我的旋转代码是在scene1 中的动作中编写并控制spinY_mc 但是一旦我进入AWComplete_mc 我不希望你能够拖动鼠标并旋转?
我确定这很简单,但我对这一切都是个菜鸟,并且正在承担一个庞大的项目!
这是影片剪辑 (spinY_mc) 上使用的代码,我不希望此代码在其子 mc (AWComplete_mc) 内工作。
// Rotation of Control Body Y
spin_Y.stop();
spin_Y.buttonMode = true;
var spin_Y:MovieClip;
var offsetFrame:int = spin_Y.currentFrame;
var offsetY:Number = 0;
var percent:Number = 0;
spin_Y.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
spin_Y.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
function startDragging(e:MouseEvent):void
{
// start listening for mouse movement
spin_Y.addEventListener(MouseEvent.MOUSE_MOVE,drag);
offsetY = stage.mouseY;
}
function stopDragging(e:MouseEvent):void
{
// STOP listening for mouse movement
spin_Y.removeEventListener(MouseEvent.MOUSE_MOVE,drag);
// save the current frame number;
offsetFrame = spin_Y.currentFrame;
}
// this function is called continuously while the mouse is being dragged
function drag(e:MouseEvent):void
{
// work out how far the mouse has been dragged, relative to the width of the spin_Y
// value between -1 and +1
percent = (mouseY - offsetY) / spin_Y.height;
// trace(percent);
// work out which frame to go to. offsetFrame is the frame we started from
var frame:int = Math.round(percent * spin_Y.totalFrames) + offsetFrame;
// reset when hitting the END of the spin_Y timeline
while (frame > spin_Y.totalFrames)
{
frame -= spin_Y.totalFrames;
}
// reset when hitting the START of the spin_Y timeline
while (frame <= 0)
{
frame += spin_Y.totalFrames;
}
// go to the correct frame
spin_Y.gotoAndStop(frame);
}