在Flash中单击其他三个按钮时,会出现一个按钮

时间:2013-06-01 14:54:06

标签: flash

我有三个动画片段:“countLettuce”,“countCheese”和“countTomatoes”。这些动画片段中的每一个都有两个帧。当click1被点击时,countLettuce从第1帧到第2帧;这对于countCheese和countTomatoes分别与button2和button3相同。现在,当我的所有三个动画片段都在第2帧时,我想要一个新的第四个按钮出现。我该怎么做?非常感谢帮助!

1 个答案:

答案 0 :(得分:1)

通过使用currentFrame属性和一些数学,您可以轻松实现目标。

这是可能的解决方案之一:

function updateButtonVisibleness(e:MouseEvent = null):void{
    var TOTAL_FRAMES:int = 2;
    forthButton.visible = (
                           (TOTAL_FRAMES-countLettuce.currentFrame) | 
                           (TOTAL_FRAMES-countCheese.currentFrame) |
                           (TOTAL_FRAMES-countTomatoes.currentFrame)
                          ) === 0;

}
button1.addEventListener(MouseEvent.CLICK, updateButtonVisibleness);
button2.addEventListener(MouseEvent.CLICK, updateButtonVisibleness);
button3.addEventListener(MouseEvent.CLICK, updateButtonVisibleness);