4 Replies Latest reply on May 30, 2007 9:39 PM by TimmyTears

    RangeError: Error #2006: The supplied index is out of bounds.

    yu.wei.qian.07
      I.
      var numChildren:Number = canvas.numChildren - 1;
      for (var i:int = 0; i < numChildren; i++) {
      if (canvas.getChildAt(i).visible == true) {
      canvas.getChildAt(i).visible = false;
      }
      }


      II.
      var numChildren:Number = canvas.numChildren - 1;
      for (var i:int = 0; i < numChildren; i++) {
      if (canvas.getChildAt(i).visible == true) {
      canvas.removeChildAt(i);
      }
      }

      The first block of codes works fine... However, with the second block it returns this error: 'RangeError: Error #2006: The supplied index is out of bounds.'

      Can somebody tell me what's wrong?