1

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?

DEMO

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.

1 Answers1

0

Did you tried to set .mouseEnabled to false and .mouseChildren to false to all other elements? See here: as3 mouseEnabled still a problem for me

Community
  • 1
  • 1
Ivan Chernykh
  • 41,617
  • 13
  • 134
  • 146
  • Thank you for answer. i have tried .mouseEnabled = false for _card, _firstCard, _secondCard, but the same, not helps for me. –  May 02 '13 at 09:39
  • No , you need to set these parameters to all cards **except** the first and second – Ivan Chernykh May 02 '13 at 09:42