操作脚本3.如何禁用允许单击功能?

时间:2013-05-02 08:48:18

标签: actionscript-3 flash function actionscript flash-cs5

我正在创建Flash"内存"游戏,想法发现2张相同的牌,但我有1个问题。 当我发现第二张卡片程序时写道:"错误转弯"它显示1秒,但此时我可以发现其他卡,第3,第4等。我需要添加类似" AllowClick = false"功能,直到显示2张牌。

据我所知,我需要使用这个: ...RemoveEventListener(MouseEvent.CLICK, checkCards);你能帮助我使用它吗?

DEMO

以下是我的代码的一部分:

            else
            {
                trace("Wrong");
                _message = "Wrong";
                message_txt.text = _message;
                 _secondCard = event.currentTarget;


                var timer:Timer = new Timer(1000, 1); //antros kortos atsivertimo laikas
                timer.addEventListener(TimerEvent.TIMER_COMPLETE, flipBack);
                timer.start();


            }
        }
        protected function flipBack(event:TimerEvent):void
{
    _firstCard.gotoAndPlay("flipBack");
    _firstCard.addEventListener(MouseEvent.CLICK, checkCards);
    _firstCard = _secondCard = undefined;             
}

我希望你理解我的问题。请问你能帮帮我吗?非常感谢你。

1 个答案:

答案 0 :(得分:0)

您是否尝试将.mouseEnabled设置为false并将.mouseChildren设置为false所有其他元素?见这里:as3 mouseEnabled still a problem for me

相关问题