2011-01-28 33 views
0

我有一个Flash菜单的问题,我从我们的图形设计师继承。它似乎在某种程度上工作,但我似乎无法挑出Actionscript 3.0代码中的错误。基本上,我们需要菜单中的每个栏(可以在链接中找到)在悬停时弹出,当鼠标离开栏时,需要向后滚动。这适用于缓慢但当你快速悬停在每个菜单项上,它会做一些奇怪的事情。Flash动画菜单,动画弹出悬停

我在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(); 

} 
+0

不考虑补间引擎请有这么多有... http://drawlogic.com/2009/02/05/as3-tween-engines-getting-lighter-with-gtweeny -bytetween-tweenlite-and-tweensyzero/ – Daniel 2011-01-28 19:33:40

回答

1

不知道你的图形设计师如何组织这个_bars的动画。所以我的猜测是将ROLL_OUT函数改为这样。

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

我从你的代码中调整了我的答案,它工作。感谢您带领我朝着正确的方向前进。 – 2011-04-08 09:39:00