I think mooska's suggestion is the most versatile to go with:
ActionScript Code:
var myMovie:MovieClip;
var items:uint = 10;
var myMovieArray:Array = new Array();
init();
function init():void {
for(var i:uint = 0; i < items; i++){
myMovie = new MovieClip();
// set myMove's properties
addChild(myMovie);
myMovieArray.push(myMovie);
}
trace(myMovieArray);
selectRandom();
}
function selectRandom():void {
var rnd:uint = Math.floor(Math.random() * items);
trace(myMovieArray[rnd] + "removed from stage.");
removeChild(myMovieArray[rnd]);
}
P.S. Using getChildByName() can be problematic.
P.P.S. In the heirachy of the DisplayList, only parents can addChild() or removeChild(), which is why removeChild(event.target) doesn't work. You need:
ActionScript Code:
event.target.parent.removeChild(event.target);
But that's another thread...