Hello all. This is pretty simple and I think I’m pretty close, but I can’t seem to get this to work. Basic functionality will be that wherever you click on the stage, a random MovieClip will be displayed.
I’ve been out of the Flash game for a few months so I’m quite rusty. Any help is greatly appreciated.
class Main {
private var $mcRef:MovieClip;
private var $myArray01:Array;
private var $clickListener:Object;
public function Main() {
this.$mcRef.$clickListener.owner = this;
Mouse.addListener($clickListener);
this.$mcRef.$clickListener.onMouseDown = function():Void {
this.owner._x = _xmouse;
this.owner._y = _ymouse;
this.owner.randStar();
}
}
private function randStar():Void {
this.$myArray01 = new Array("star01", "star02", "star03", "star04", "star05");
var myArrayLength:Number = this.$myArray01.length;
var inRand:Number = random(myArrayLength);
this.$mcRef.attachMovie($myArray01[inRand], $myArray01[inRand]+"_2", 1);
}
}