Action Script 3. How to disable Allow Click function?

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.

Answers


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


Need Your Help

Changing member types in inheritance

c++ templates inheritance

Given a base class Base that has two derived classes, DerA and DerB, can the derived classes have a member variable that is used in a Base member function, but is a different type for each class?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.