开发者

Flash menu with animated pop out on hover

I have a problem with a Flash menu I have inherited from our graphics designer. It seems to be working to a certain extent but I can't seem to pick out the error in the Actionscript 3.0 code. Basically we need each bar in the menu (which you can find at the link) to pop out when hovered over, and when the mouse moves away from the bar, it needs to roll back in. This works when you do it slowly but when you hover over each menu item quickly it does some strange things.

I don't have much experience in Flash but from a programming point of view, my theory is that no threading is being used. By this I mean that the mouse over is happening so quickly that it ignores the mouse out for one menu item and skips to the mouse in for the other. I hope this makes sense. Below is the link to the website and the code in our Actionscript file.

If I haven't explained enough then please let me know and I'll amend the question.

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(ev开发者_如何学Got:MouseEvent):void{

    employee_bar.play();

}

employee_bar.addEventListener(MouseEvent.ROLL_OUT, animate20MC);

function animate20MC(evt:MouseEvent):void{

    employee_bar.play();

}


Not sure how your graphical designer organize animation of this _bars. So my guess will be to change the ROLL_OUT functions to something like this.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜