I have a very simple movie that randomly places a movie clip:
**Frame 1:**
i=0;
**Frame 2:**
_root.tile.duplicateMovieClip("tile"+i,i+1)
_root["tile"+i]._x=Math.random()*550+20;
_root["tile"+i]._y=Math.random()*320+20;
_root["tile"+i]._xscale=Math.random()*50+10;
_root["tile"+i]._yscale=Math.random()*90+8;
_root["tile"+i]._alpha=Math.random()*100+1;
_root["tile"+i]._rotation=Math.random()*45+10;
**Frame 3:**
if(i<30){
++i
gotoAndPlay(2)
}else{
gotoAndStop(1)
}
Once i gets to 30, the movie stops.
I want to remove all of the MCs via a button, and restart the movie.
I can remove them, but I can’t seem to restart the movie - by that I mean that the MCs are removed, but the movie doesn’t start again by randomly placing MCs - instead, one MC instance fires off, and then nothing. These are the actions on the button:
on (release) {
i=1;
gotoAndPlay(1);
var i = 0;
var ref = null;
for(i in this)
{
if(typeof (ref = this*) == "movieclip")
ref.removeMovieClip();
}
}
Files:
swf: [COLOR=#0000ff]http://jimpix.co.uk/gws02.swf[/COLOR]
fla: [COLOR=#0000ff]http://jimpix.co.uk/gws02.fla[/COLOR]