3 Replies Latest reply on Jul 31, 2009 3:14 PM by kglad

    If statement frustrating me.

    rainestorm Level 1

      I just can't seem to get them down. I posted this yesterday but I just can't work it out. This is the current code before trying the if statement:

      stop();
      var my_timedReveal:Number = setTimeout(my_delayedReveal,15000,1);
      function my_delayedReveal(arg1) {
      gotoAndPlay("reveal2");
      }
      cardA.Mouse.addListener(mouseDown);
      cardB.Mouse.addListener(mouseDown);
      cardC.Mouse.addListener(mouseDown);
      cardA.onRelease = function() {
      gotoAndPlay("reveal1");
      }
      cardB.onRelease = function() {
      gotoAndPlay("reveal2");
      }
      cardC.onRelease = function() {
      gotoAndPlay("reveal3");
      }


      The problem is that even if a user clicks cardA, cardB or cardC, the timeout function still goes after 15 seconds and plays the "reveal2" frame.
      Here's the if statement I tried to use:

      stop();
      cardB.Mouse.addListener(mouseDown);
      cardC.Mouse.addListener(mouseDown);
      cardA.onRelease = function() {
      gotoAndPlay("reveal2");
      }
      cardC.onRelease = function() {
      gotoAndPlay("reveal3");
      }
      var my_timedReveal:Number = setTimeout(my_delayedReveal,15000,1);
      if (cardA.mouseDown == true) {
      gotoAndStop("reveal1")
      }
      else {
      my_delayedReveal = true;
      }


      What I want to happen is this. If a user clicks cardA, cardB, or cardC, go to the frame indicated ("reveal1" "reveal2" etc.).  If they don't click, then timeout function should go to the "reveal2" frame. But ONLY if they don't click.


      Please help. I just can't seem to grasp this.