1 Reply Latest reply on Nov 17, 2006 9:37 PM by jonnybennett

    Var problem

    Sterockicy Level 1
      Why doesnt the following IF code work?
      By the way its a target shooting game and when you click the "total" var goes up.

      var shots = 0;
      var total= 0;
      onMouseDown = function () {
      total +=1;
      }
      if(total == 10){
      _root.nextFrame();
      }

      All help would be appreciated for this simple code mistake or whatever it is.
        • 1. Var problem
          jonnybennett Level 1
          what isn't working? I asume that you want to do the check if total==10 when the onMouseDown is executed? rather than the code you have now that only does the check when first loaded... therefore...

          onMouseDown = function () {
          total +=1;
          if(total == 10){
          _root.nextFrame();
          }}

          however you haven't really explained what isn't working, so I might be wrong.