hi, i want to create a simple game.in the game, i randomly generate number of aphids so every time i open the game, i will have different number of aphids on the screen. the idea of the game is if i could find all the aphids which is randomly appear, i can go to the next frame. but i currently stuck because i still cant go to the next frame. can someone help me try to figure it out.
Code:
stop();

var holder:Sprite = new Sprite();
addChild(holder);

var numAphidsCreated:int = 10;
var numAphidsFound:int = 0;

for (var i:int; i < numAphidsCreated; i++) 
{
	var arrayAphid:Array = new Array();
	holder.y = 400;


	arrayAphid[i]= new aphids();
	holder.addChild(arrayAphid[i]);
	//**
	arrayAphid[i].buttonMode = true;
	arrayAphid[i].addEventListener(MouseEvent.CLICK, objectFound);
	//**
	arrayAphid[i].x = Math.random()*stage.stageWidth;
	arrayAphid[i].y = Math.random()*stage.stageHeight;
	//arrayAphid[i].scaleX = arrayAphid[i].scaleY = Math.random();

	arrayAphid[i].gotoAndPlay(Math.ceil(Math.random()*15));
}
//**
function objectFound(e:MouseEvent):void
{
	var aphids:MovieClip = e.currentTarget as MovieClip;
	aphids.removeEventListener(MouseEvent.CLICK, objectFound);

	// Set the object's visibility to false
	aphids.visible = false;
	
	trace('> ' + aphids.name + ': founded');
	trace('> objects founded: ' + numAphidsFound);

	numAphidsFound++;

	if (numAphidsFound == numAphidsCreated)
	{
		trace('> all found!');
		nextFrame();
	}
}