PDA

View Full Version : duplicate lots of times simultaneously?


poab
07-19-2001, 10:39 AM
Hi,

Firstly, sorry if there is a post from someone that covers this, but i didn't find it, if there is.

What I want to do is this:

Starting with a movieclip, it should duplicate itself, with the new clip being a little way away so you can see it. Then I want both of those clips to duplicate in the same way. I know all this would happen instantaneously but I've been using the timelines to act as , well, timelines actually. So the whole thing's staggered. But I can't get it to work.

The easiest way to think of it is like the multiplication of cells in the real world. So 1 becomes 2, 2 become 4, 4 become 8...etc. It's essential that I'd be able to specify the exact coordinates of the new cells.

Could anyone help me with this? I'd really appreciate it.

defrex
07-19-2001, 07:09 PM
hmmm, i'm not sure if this is what you're looking for but:

onClipEvent (load) {
for (var i = 0; i != -1; i++) {// this will go forever. change it to whatever you want.
duplicateMovieClip ("mc", "mc"+i, i);
setProperty ("mc"+i, _y, i);
}
}

you can just do whatever with the setProperty stuff, to do what you want. oh, and fix the 'i != -2' thing, it'll probly blow up your computer.

Jesse
07-20-2001, 04:47 AM
Frame one of the main movie put this:
xArray = new Array();
yArray = new Array();
for (j=0; j<=300; j++) {
xArray[j] = random(500);
yArray[j] = random(500);
} This generates 2 arrays of random X and Y positions. You said you need to be able to specify the locations so into these arrays you can manually enter (or use an algorythm to enter) the _x and _ys you want, but I just made them random.
Then make you cell clip and put this code ON it:
onClipEvent (enterFrame) {
if (_root.count<300) {
_root.count++;
name = "cell"+_root.count;
this.duplicateMovieClip(name, _root.count);
_root[name]._x = _root.xArray[_root.count];
_root[name]._y = _root.yArray[_root.count];
}
}
Note that this is exponential growth so it will get to 300 (the limit set by the IF) very quickly.

poab
07-23-2001, 03:34 PM
Cheers, works brilliantly. :o)