2011-01-28 71 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