4 Replies Latest reply on Oct 26, 2017 7:59 PM by MrKendo

    if all conditions = true

    MrKendo

      Hi,

       

      Can I make the following work so that it only works if all are true? As it stands it functions if any are true. Just to clarify, all Dice must be true before the EventListener is removed.

       

      function fEndP1 (evt:MouseEvent):void{

                                          if          ((MC_Dice1.visible = true) &&

                                                      (MC_Dice2.visible = true) &&

                                                      (MC_Dice3.visible = true) &&

                                                      (MC_Dice4.visible = true) &&

                                                      (MC_Dice5.visible = true) &&

                                                      (MC_Dice6.visible = true))

                                                     

                                          BTN_Button.removeEventListener(MouseEvent.CLICK,fMainProgram);

      Thanks in advance!

       

      Anthony

        • 1. Re: if all conditions = true
          macpawel Adobe Community Professional

          try to use double == in your condition

          • 2. Re: if all conditions = true
            marcanw Level 1

            Maybe I'm missing something but visible being boolean why you don't use:

                                               if          (MC_Dice1.visible &&

                                                            MC_Dice2.visible &&

                                                            MC_Dice3.visible &&

                                                            MC_Dice4.visible &&

                                                            MC_Dice5.visible &&

                                                            MC_Dice6.visible)

             

            if .visible is an object then you should use MC_Dice1.visible == true

            1 person found this helpful
            • 3. Re: if all conditions = true
              Ned Murphy Adobe Community Professional & MVP

              As marcanw indicates, when you are testing a boolean property you do not need to use the ==.  A conditional is simply evaluating the true or false value of the arguments, so if the values are already boolean (true or false) then you can simply evaluate their value rather than compare them to equaling true or false.

              • 4. Re: if all conditions = true
                MrKendo Level 1

                Hi again,

                 

                Thanks for the input.This now works a treat!!! Thanks