View Full Version : Limit to # of movies duplicated by duplicateMovie Clip

07-09-2001, 11:21 PM
I'm attempting to use a button with a duplicateMovieClip.
I've used the following script on a button (taken from the "samples" menu item installed under Flash 5 help. (looks sort of like Flash 4 syntax, but it works).

I also created "n" at my root timeline level.

on (press) {
bn = "drop" add n;
duplicateMovieClip ("drop", bn, n);
setProperty (bn, _x, (170+Number(n)*30));
setProperty (bn, _y, 40);
n = Number(n)+1;
set (bn add ":n", n);

My question is this: When I click the button in rapid succession, the MC duplicates to a point - however as I continue to click the button it will only make like 10 MCs without starting to delete, or unload (not sure) the MCs that it's previously created. In effect, it looks like there's some (is this unspoken, unwritten?) limit to the # of duplicateMovieClip actions that can take place.

Can anyone tell me if I'm crazy here, or if there's something I'm doing wrong, etc. Any and all help is greatly appreciated.


20 Ton Squirrel
07-10-2001, 08:20 PM
Hey there... I hope you don't mind an example in F5, cuz I tend not to mess with stepping back. I dunno why your code didn't work per-se, I wrote this in a hacked together example and it worked like a charm.

The variable "n" is initialized in the main timeline
on (press) {
bn = "drop" + n;
drop.duplicateMovieClip(bn, n);
_root[bn]._x = (170+Number(n)*30));
_root[bn]._y = 40;
_root[bn].n = n;

You might code something to put the duped MC on a new row once it reaches a certain limit, otherwise after the Nth dupe they will be off-screen.

Hope that helps ya.