答案 0 :(得分:0)
首先,你应该创建一个你想要锤子在点击时执行的动画。然后在用户鼠标按下时执行该动画。
让我们说锤子有一个动画,然后从第2帧开始;
private function MainFunction():void
{
hammerMC.addEventListener(MouseEvent.MOUSE_DOWN, CursorDown);
hammerMC.addEventListener(MouseEvent.MOUSE_UP, CursorUp);
//and other required events...
}
private function CursorDown(ref:MouseEvent):void
{
hammerMC.gotoAndPlay(2);//hammerMC.nextFrame();
//...
}
private function CursorUp(ref:MouseEvent):void
{
//we do this because we want cursor comes back to default status after we release the mouse button
//otherwise it sticks to mouse down animation
hammerMC.gotoAndStop(1);
//...
}
我想这可以完成这项工作。