8 Replies Latest reply on Jun 11, 2009 7:50 AM by kglad

    This text output makes NO sense! - what am I missing???

    DIY_Lobotomy Level 1

      Okay - here's my code (I'll explain in a second):

      Code:
      var tempComplete:Number = 0;
      _root.sd2Text_txt.text = "";
      for(i:Number=0;i<_root.completedArray.length;i++) {
           _root.sd2Text_txt.text += " - CA:" + _root.completedArray[i];
           if (_root.completedArray[i] == true) {
                tempComplete++;
                _root.sd2Text_txt.text += " - " + i;
           }
           _root.sd2Text_txt.text += " - TC:" + tempComplete;
      }

      By that logic, if "completedArray" has only two values in it that are both true, then the "sd2Text_txt" textbox should read:

      Code:
       - CA:true - 0 - TC:0 - CA:true - 1 - TC:1

      Correct?

      Okay - here's what's really being displayed in the textbox, though:

      Code:
       - CA:true - TC:0 - CA:true - 1 - TC:1

      There's no logic in that! The output proves that both parts of the array are true. And yet, the "if" statement only activates once!!!

      Any thoughts???

      Thanks!