带有动画的Flash菜单在悬停时弹出

时间:2011-01-28 10:11:12

标签: flash actionscript-3 actionscript animation

我从我的图形设计器继承的Flash菜单有问题。它似乎在某种程度上起作用,但我似乎无法在Actionscript 3.0代码中找出错误。基本上我们需要菜单中的每个栏(您可以在链接中找到)在悬停时突然弹出,当鼠标离开栏时,它需要重新滚入。这可以在您慢慢地执行时工作你快速地将鼠标悬停在每个菜单项上,它会做一些奇怪的事情。

我在Flash方面没有太多经验,但从编程的角度来看,我的理论是没有使用线程。通过这个我的意思是鼠标结束发生得如此之快,它忽略了鼠标输出一个菜单项,并跳过鼠标进入另一个菜单项。我希望这是有道理的。下面是网站的链接和我们的Actionscript文件中的代码。

如果我没有解释得那么请告诉我,我会修改这个问题。

http://www.thehrdirectory.co.uk/HR_Directory_Flash_Menu.swf

//<item>_bar is the alias given to each menu item.


contracts_bar.stop();

contracts_bar.addEventListener(MouseEvent.ROLL_OVER, animateMC);

function animateMC(evt:MouseEvent):void{

    contracts_bar.play();

}

contracts_bar.addEventListener(MouseEvent.ROLL_OUT, animate2MC);

function animate2MC(evt:MouseEvent):void{


    contracts_bar.play();

}

dispute_bar.stop();

dispute_bar.addEventListener(MouseEvent.ROLL_OVER, animate3MC);

function animate3MC(evt:MouseEvent):void{

    dispute_bar.play();

}

dispute_bar.addEventListener(MouseEvent.ROLL_OUT, animate4MC);

function animate4MC(evt:MouseEvent):void{

    dispute_bar.play();

}

resourcing_bar.stop();

resourcing_bar.addEventListener(MouseEvent.ROLL_OVER, animate5MC);

function animate5MC(evt:MouseEvent):void{

    resourcing_bar.play();

}

resourcing_bar.addEventListener(MouseEvent.ROLL_OUT, animate6MC);

function animate6MC(evt:MouseEvent):void{

    resourcing_bar.play();

}

performance_bar.stop();

performance_bar.addEventListener(MouseEvent.ROLL_OVER, animate7MC);

function animate7MC(evt:MouseEvent):void{

    performance_bar.play();

}

performance_bar.addEventListener(MouseEvent.ROLL_OUT, animate8MC);

function animate8MC(evt:MouseEvent):void{

    performance_bar.play();

}

training_bar.stop();

training_bar.addEventListener(MouseEvent.ROLL_OVER, animate9MC);

function animate9MC(evt:MouseEvent):void{

    training_bar.play();

}

training_bar.addEventListener(MouseEvent.ROLL_OUT, animate10MC);

function animate10MC(evt:MouseEvent):void{

    training_bar.play();

}

strategy_bar.stop();

strategy_bar.addEventListener(MouseEvent.ROLL_OVER, animate11MC);

function animate11MC(evt:MouseEvent):void{

    strategy_bar.play();

}

strategy_bar.addEventListener(MouseEvent.ROLL_OUT, animate12MC);

function animate12MC(evt:MouseEvent):void{

    strategy_bar.play();

}

compensation_bar.stop();

compensation_bar.addEventListener(MouseEvent.ROLL_OVER, animate13MC);

function animate13MC(evt:MouseEvent):void{

    compensation_bar.play();

}

compensation_bar.addEventListener(MouseEvent.ROLL_OUT, animate14MC);

function animate14MC(evt:MouseEvent):void{

    compensation_bar.play();

}

organisational_bar.stop();

organisational_bar.addEventListener(MouseEvent.ROLL_OVER, animate15MC);

function animate15MC(evt:MouseEvent):void{

    organisational_bar.play();

}

organisational_bar.addEventListener(MouseEvent.ROLL_OUT, animate16MC);

function animate16MC(evt:MouseEvent):void{

    organisational_bar.play();

}

talent_bar.stop();

talent_bar.addEventListener(MouseEvent.ROLL_OVER, animate17MC);

function animate17MC(evt:MouseEvent):void{

    talent_bar.play();

}

talent_bar.addEventListener(MouseEvent.ROLL_OUT, animate18MC);

function animate18MC(evt:MouseEvent):void{

    talent_bar.play();

}

employee_bar.stop();

employee_bar.addEventListener(MouseEvent.ROLL_OVER, animate19MC);

function animate19MC(evt:MouseEvent):void{

    employee_bar.play();

}

employee_bar.addEventListener(MouseEvent.ROLL_OUT, animate20MC);

function animate20MC(evt:MouseEvent):void{

    employee_bar.play();

}

1 个答案:

答案 0 :(得分:1)

不确定图形设计师如何组织此_bars的动画。所以我的猜测是将ROLL_OUT函数更改为这样的东西。

contracts_bar.stop();
contracts_bar.gotoAndPlay(contracts_bar.totalFrames/2 + (contracts_bar.totalFrames/2 - contracts_bar.currentFrame));