I know this has to be simple, but I can’t solve the problem. I’m trying to call a random MovieClip from the library each time the user clicks. The MovieClip names are stored in the array. I can get a single clip to work without the array, but not with. The main problem lies, I think, in trying to apply randomStar to currStar.
The tutorial this code references is http://www.kirupa.com/developer/flashcs3/animating_dynamic_movieclips_AS3_pg1.htm
Quick help? Thanks much in advance.
function Main() {
stage.addEventListener(MouseEvent.CLICK, AddStar);
}
Main();
var starArray:Array = new Array("star01", "star02", "star03", "star04", "star05");
var randomStar = starArray[Math.random() * starArray.length];
function AddStar(e:MouseEvent):void {
var currStar = new randomStar();
this.addChild(currStar);
currStar.x = mouseX;
currStar.y = mouseY;
currStar.addEventListener(Event.ENTER_FRAME, PlayStar);
}
function PlayStar(e:Event):void {
var starMC:MovieClip = MovieClip(e.target);
}