2 Replies Latest reply on Jul 30, 2009 2:49 PM by Ned Murphy

    if else statement not working


      I'm sure I have the conditions and statements typed in wrong. Here is the original code:




      var my_timedReveal:Number = setTimeout(my_delayedReveal,15000,1);

      function my_delayedReveal(arg1) {




      cardA.onRelease = function() {

      cardB.onRelease = function() {

      cardC.onRelease = function() {


      only now I want to add an if/else statement so that if none of the mouseDown conditions are met, it then goes the the Timeout variable:


      I tried this to no avail:


      var my_timedReveal:Number = setTimeout(my_delayedReveal,15000,1);

      if (cardA.mouseDown = true) {

      else {
          my_delayedReveal = true;


      What am I missing? Am I even close?

        • 1. Re: if else statement not working
          Ned Murphy Adobe Community Professional & MVP

          I haven't tried to reason out your code, but when you are comparing things for equality you use ==, not =


          if (cardA.mouseDown == true) {


          And in the case of a boolean comparison like that you could just use...


          if (cardA.mouseDown) {


          So see if whatever you are trying or might have tried works when using the comparison correctly.

          • 2. Re: if else statement not working
            rainestorm Level 1

            Thanks, Ned. I actually originally tired it without the =true statement.


            What I'm trying do is this: A user has the option to click on an object and that object flips over. If they fail to click an object, that object flips over after 15 seconds. But the setTimeout variable can ONLY come into play if the the user does not click an object. Otherwise, what's happens is the user clicks the object, the object flips over, and 15 seconds later it flips over again.