Duplicate 1 MC at a time in a loop? (Flash 8)
Hey, I got this working but it duplicates the number of MCs in the loop all in one click.
I want it to duplicate the MC 1 at a time as the user clicks the button until the loop number limit is reached. Can anyone help me out here?
on (release) {
for(var i:Number = 1; i < 10; i++) {
_root.cell.duplicateMovieClip("cell" + i, i, {_x:200, _y:200});
}
}
Thanks in advance!
Spit
Feel like I'm loosing my mind...
:crazy: OK, I had this working where it would create 5 duplicate MCs of a MC called "cell". But as I was playing with other things in the movie, I came back to this and it started doing what it did before even after I removed all the new stuff I added.
It only duplicates the first and then the next time you press the button it just repositions the first duplicate to a different spot. It was making 5. :confused:
// Executes when the Duplicate button is released
var i:Number = 0;
_root.Duplicate.onRelease = function(){
i++;
if (cellCount < 5) {
_root.cell.duplicateMovieClip("cell" + i, i, {_x: 100+random(400), _y: 100+random(400)});
_global.cell_created = 1;
_global.cellCount = cellCount + 1;
}
count.text = cellCount;
}