Randomize Saved movieclips stored on children
i'm having a hard time on a code in actionscript 3.0. i want to randomize the movieclips stored in child and picks only 8 movieclips wherein there are 10 movieclips. the set up of my game is you need to click on objects (movieclips), 8 object must be the total number of given objects. hope you'll answer my problem.

here is the code:

//start the stage select menu

this.mainmc.addEventListener (Event.ENTER_FRAME, setupMenu1);

this.waitingCounter=0;

//this function sets up stage select buttons

function setupMenu1 (e:Event) {

	//wait for timeline
	if (this.waitingCounter<2) {
		this.waitingCounter++;
		//not ready yet, do nothing
		return;
	}
	//listeners
	this.mainmc.stage1.addEventListener (MouseEvent.CLICK, pickStage1);
	//remove this listener since we have run it
	this.mainmc.removeEventListener (Event.ENTER_FRAME, setupMenu1);
}

//pick the stage to play

function pickStage1 (e:MouseEvent) {

	//go to selected frame
	this.mainmc.gotoAndStop (e.target.name);
	//start stage function
	this.mainmc.addEventListener (Event.ENTER_FRAME, setupStage1);
	this.waitingCounter=0;
	this.numOfHints=3;
	this.hintcount=0;
}

//set up current stage

function setupStage1 (e:Event) {

	//wait for timeline
	if (this.waitingCounter<2) {
		this.waitingCounter++;
		//not ready yet, do nothing
		return;
	}
	//Start the timer
	timer.start();
	//hide hint
	this.mainmc.hintmc.visible=false;
	//hide star animation
	this.mainmc.starAnimation.visible=false;
	//listener for hint button
	this.mainmc.hintbut.addEventListener (MouseEvent.CLICK, showHint1);
	//create objects array
	this.obArr=[];
	//count the objects on stage
	for (var n=0; n<this.mainmc.numChildren; n++) {
		//get the children
		var ob=this.mainmc.getChildAt(n);
		//only take movie clips
		if (ob is MovieClip) {
			//only count the movie clips that have name declared
			if (ob.myname!=null) {
				//push to array
				this.obArr.push (MovieClip(ob));
			}
		}
	}
	//clear the list
	this.mainmc.nameslist.text="";
	//build objects list
	for (n=0; n<this.obArr.length; n++) {
		//add the name of object
		this.mainmc.nameslist.appendText (String (this.obArr[n].myname));
		this.mainmc.nameslist.appendText ("\n\n");
	}
	//this is not needed anymore
	this.mainmc.removeEventListener (Event.ENTER_FRAME, setupStage1);
	//add click event
	this.mainmc.addEventListener (MouseEvent.CLICK, clickOb1);
}

//stage was clicked

function clickOb1 (e:MouseEvent) {

	var clicked1=false;
	//check which object was clicked
	for (var n=0; n<this.obArr.length; n++) {
		//add the name of object
		if (this.obArr[n].hitTestPoint(this.mainmc.mouseX,this.mainmc.mouseY, true)) {
			//object is clicked
			clicked1=true;
			//show hint
			this.mainmc.starAnimation.visible=true;
			//place animation to pick object
			this.mainmc.starAnimation.x=this.obArr[n].x;
			this.mainmc.starAnimation.y=this.obArr[n].y;
			//play the star animation
			this.mainmc.starAnimation.gotoAndPlay (2);
			//hide
			this.obArr[n].visible=false;
			//remove from array
			this.obArr.splice (n,1);
		}
	}
	//rebuild text list
	if (clicked1) {
		//clear the list
		this.mainmc.nameslist.text="";
		//build objects list
		for (n=0; n<this.obArr.length; n++) {
			//add the name of object
			this.mainmc.nameslist.appendText (String(this.obArr[n].myname));
			this.mainmc.nameslist.appendText ("\n\n");
		}
		//check if array is empty meaning all objects were removed
		if (n==0) {
			SoundMixer.stopAll();
			this.gotoAndStop(10);
			timer.stop();
		}
	}
}

//show hint

function showHint1 (e:MouseEvent) {

	//check if there are hidden objects
	if (this.obArr.length>0) {
		//pick one object randomly
		var n=Math.floor(Math.random()*this.obArr.length);
		var ob=this.obArr[n];
		this.hintcount++;
		//show hint
		this.mainmc.hintmc.visible=true;
		//place hint to the object coordinates
		this.mainmc.hintmc.x=this.obArr[n].x;
		this.mainmc.hintmc.y=this.obArr[n].y;
		//play aniation in the hint mc
		this.mainmc.hintmc.gotoAndPlay (2);
		//play buko animation
		if (this.hintcount==1) {
			//listeners
			this.mainmc.buko1.gotoAndPlay (2);
			this.mainmc.buko1.visible=false;
			}
		if (this.hintcount==2) {
			//listeners
			this.mainmc.buko2.gotoAndPlay (2);
			this.mainmc.buko2.visible=false;
			}
		if (this.hintcount==3) {
			//listeners
			this.mainmc.buko3.gotoAndPlay (2);
			this.mainmc.buko3.visible=false;
			}
		//hint less 1
		this.numOfHints--;
		//hint reaches 0
		if(this.numOfHints==0){
    		this.mainmc.hintbut.mouseEnabled=false;
		} 
	}
}
Randomize Saved movieclips stored on children
===

i'm having a hard time on a code in actionscript 3.0. i want to randomize the movieclips stored in child and picks only 8 movieclips wherein there are 10 movieclips. the set up of my game is you need to click on objects (movieclips), 8 object must be the total number of given objects. hope you'll answer my problem.

here is the code:

//start the stage select menu

this.mainmc.addEventListener (Event.ENTER_FRAME, setupMenu1);

this.waitingCounter=0;

//this function sets up stage select buttons

function setupMenu1 (e:Event) {

	//wait for timeline
	if (this.waitingCounter<2) {
		this.waitingCounter++;
		//not ready yet, do nothing
		return;
	}
	//listeners
	this.mainmc.stage1.addEventListener (MouseEvent.CLICK, pickStage1);
	//remove this listener since we have run it
	this.mainmc.removeEventListener (Event.ENTER_FRAME, setupMenu1);
}

//pick the stage to play

function pickStage1 (e:MouseEvent) {

	//go to selected frame
	this.mainmc.gotoAndStop (e.target.name);
	//start stage function
	this.mainmc.addEventListener (Event.ENTER_FRAME, setupStage1);
	this.waitingCounter=0;
	this.numOfHints=3;
	this.hintcount=0;
}

//set up current stage

function setupStage1 (e:Event) {

	//wait for timeline
	if (this.waitingCounter<2) {
		this.waitingCounter++;
		//not ready yet, do nothing
		return;
	}
	//Start the timer
	timer.start();
	//hide hint
	this.mainmc.hintmc.visible=false;
	//hide star animation
	this.mainmc.starAnimation.visible=false;
	//listener for hint button
	this.mainmc.hintbut.addEventListener (MouseEvent.CLICK, showHint1);
	//create objects array
	this.obArr=[];
	//count the objects on stage
	for (var n=0; n<this.mainmc.numChildren; n++) {
		//get the children
		var ob=this.mainmc.getChildAt(n);
		//only take movie clips
		if (ob is MovieClip) {
			//only count the movie clips that have name declared
			if (ob.myname!=null) {
				//push to array
				this.obArr.push (MovieClip(ob));
			}
		}
	}
	//clear the list
	this.mainmc.nameslist.text="";
	//build objects list
	for (n=0; n<this.obArr.length; n++) {
		//add the name of object
		this.mainmc.nameslist.appendText (String (this.obArr[n].myname));
		this.mainmc.nameslist.appendText ("\n\n");
	}
	//this is not needed anymore
	this.mainmc.removeEventListener (Event.ENTER_FRAME, setupStage1);
	//add click event
	this.mainmc.addEventListener (MouseEvent.CLICK, clickOb1);
}

//stage was clicked

function clickOb1 (e:MouseEvent) {

	var clicked1=false;
	//check which object was clicked
	for (var n=0; n<this.obArr.length; n++) {
		//add the name of object
		if (this.obArr[n].hitTestPoint(this.mainmc.mouseX,this.mainmc.mouseY, true)) {
			//object is clicked
			clicked1=true;
			//show hint
			this.mainmc.starAnimation.visible=true;
			//place animation to pick object
			this.mainmc.starAnimation.x=this.obArr[n].x;
			this.mainmc.starAnimation.y=this.obArr[n].y;
			//play the star animation
			this.mainmc.starAnimation.gotoAndPlay (2);
			//hide
			this.obArr[n].visible=false;
			//remove from array
			this.obArr.splice (n,1);
		}
	}
	//rebuild text list
	if (clicked1) {
		//clear the list
		this.mainmc.nameslist.text="";
		//build objects list
		for (n=0; n<this.obArr.length; n++) {
			//add the name of object
			this.mainmc.nameslist.appendText (String(this.obArr[n].myname));
			this.mainmc.nameslist.appendText ("\n\n");
		}
		//check if array is empty meaning all objects were removed
		if (n==0) {
			SoundMixer.stopAll();
			this.gotoAndStop(10);
			timer.stop();
		}
	}
}

//show hint

function showHint1 (e:MouseEvent) {

	//check if there are hidden objects
	if (this.obArr.length>0) {
		//pick one object randomly
		var n=Math.floor(Math.random()*this.obArr.length);
		var ob=this.obArr[n];
		this.hintcount++;
		//show hint
		this.mainmc.hintmc.visible=true;
		//place hint to the object coordinates
		this.mainmc.hintmc.x=this.obArr[n].x;
		this.mainmc.hintmc.y=this.obArr[n].y;
		//play aniation in the hint mc
		this.mainmc.hintmc.gotoAndPlay (2);
		//play buko animation
		if (this.hintcount==1) {
			//listeners
			this.mainmc.buko1.gotoAndPlay (2);
			this.mainmc.buko1.visible=false;
			}
		if (this.hintcount==2) {
			//listeners
			this.mainmc.buko2.gotoAndPlay (2);
			this.mainmc.buko2.visible=false;
			}
		if (this.hintcount==3) {
			//listeners
			this.mainmc.buko3.gotoAndPlay (2);
			this.mainmc.buko3.visible=false;
			}
		//hint less 1
		this.numOfHints--;
		//hint reaches 0
		if(this.numOfHints==0){
    		this.mainmc.hintbut.mouseEnabled=false;
		} 
	}
}