I have a simple FLA which loops through some keyframes and randomly places movie clips on the stage.
Frame 1:
Contains nothing
Frame 2:
_root.tile.duplicateMovieClip("tile"+i,i+1)
_root["tile"+i]._x=Math.random()*800;
_root["tile"+i]._y=Math.random()*600;
this = Math.random()*100;
_root["tile"+i]._xscale=this;
_root["tile"+i]._yscale=this;
_root["tile"+i]._alpha=Math.random()*100+10;
Frame 3:
if(i<100){
++i
gotoAndPlay(2)
}else{
gotoAndStop(4)
}
Frame 4:
i=0;
stop();
On Frame 4, I add a button which I’d like to use to restart the whole thing.
The button has this AS on it:
on (release) {
i=0;
var ref = null;
for(i in this)
{
if(typeof (ref = this*) == "movieclip")
ref.removeMovieClip();
}
gotoAndPlay(1);
}
But when I click the button, it doesn’t restart at all.
The SWF example is here:
http://jimpix.co.uk/junk/christmas-rainbows.swf
If it helps, the FLA is here:
http://jimpix.co.uk/junk/christmas-rainbows.fla
Any advice about what I’m doing wrong would be gratefully received.
Thanks!