Logic correction in function(cube click)

Hii, i'm trying to execute one function , but not able to complete it successfully, if anybody is there help me .

this is my function code

var clicked : boolean; //Will default to False

function OnMouseDown () {
  clicked = true; //Set this one to true
  Debug.Log("clicked");
  CheckCubes();
}

function CheckCubes() {
  var cubes = this.gameObject.FindGameObjectsWithTag("ClickObjects");
  for (i=0;i<cubes.length;i++) {

    if(clicked) {
     cubes*.active=false;*
 *}*
 *if (!clicked) {*
 *break;* 
 *}*
 _if(cubes*.active==false) { // its checking that all cubes are false*_
 _*clicked=true;*_
 _*}*_
 _*if(clicked==true) {*_
 _*Application.LoadLevel("level1");*_
 _*}*_
 _*}*_
_*}*_
_*```*_
_*<p>when i'm try to execute it, </p>*_
_*<ol>*_
_*<li>if i'll click on any cube , it considers that all cubes are clicked, and directly going to next level.*_
_*why is it so?</li>*_
_*</ol>*_

You could use this script:

Send a ray from mouse position, check if object with tag “ClickObjects” was hit, deactivate this object, decrease a counter and if it is zero load the next level.

var cubeCount : int;

if(Input.GetMouseButtonDown(0)) {
  var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
  var mousehit : RaycastHit;        
  if (Physics.Raycast (ray, mousehit) && (mousehit.collider.tag == "ClickObjects")) {
    mousehit.transform.gameObject.active = false;
    cubeCount --;
    if (cubeCount == 0)
      Application.LoadLevel("level1");
  }
}

Your final if (clicked == true) should be outside the 'for' loop. BTW You can use just 'if (clicked)'