I'm creating Flash "memory" game, Idea to discover 2 equal cards, but I have 1 problem. When I discover second card program write: "Wrong turn" and It is shown for 1 second, but at this time I can discover other cards, 3rd, 4th etc. I need to add something like "AllowClick = false" function, till 2 cards are shown.
As I understand I need to use this:
...RemoveEventListener(MouseEvent.CLICK, checkCards);
Could you help me to use It correct?
Here is part of my code:
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;
}
I hope you understood my question. Could you help me, please? Thank you very much.