验证按钮是否被单击actionscript3

时间:2014-04-11 12:29:27

标签: actionscript-3 mouseevent movieclip event-listener

我有9个动画片段,都有它们的功能,我想在用户点击所有动画片段后显示一条消息。

EX:

button1.addEventListener(MouseEvent.CLICK, showText1);
button2.addEventListener(MouseEvent.CLICK, showText2);
button3.addEventListener(MouseEvent.CLICK, showText3);

function showText1(e.Event)
{
text1.visible=true;
}

...

如何检查是否点击了所有按钮,然后显示消息?

谢谢。

1 个答案:

答案 0 :(得分:0)

每次点击都会调用类似test的功能。在该函数中执行类似于:

的操作
function test() {
    for (var i:uint = 0; i < 9; i++) {
        if (this["text" + i].visible != false) { // do proper check; maybe visible, or maybe some variables - whatever fits your needs
            return false;
        }
    }
    return true; // do whatever you want here - all are 'clicked';
}