PDA

View Full Version : Duplicate MovieClip


Sarah012
08-12-2003, 08:30 AM
I have a movie clip (smallwheel) that contains two movie clips (wheelclip1, wheelclip2). At the begining of the movieclip (smallwheel3) only wheelclip1 is visible, after a simple motion tween only wheelclip2 is visible. Wheelclip2 can then be dragged. What I would like to happen is this:

After Wheelclip2 has been dragged and released a duplicate of the movie (smallwheel3) is created and place in the original position.

The duplication occurs but after the second wheelclip2 is dragged and released it simply disapears. I would like to be able to have many copies of wheelclip2 that can be dragged on press.

Here is the code that I have placed on wheelclip2:

on (press) {
startDrag(_this);
}
on (release) {
stopDrag();
for(i=1;i<i+1;i++);{
duplicateMovieClip("_root.draw.smallwheel3","smallwheel3"+i,i);}
}

Any help would be greatly appreciated.
Thanks

Billy T
08-12-2003, 08:39 AM
initialise a variable on the same timeline that the buttons exist

eg

i=0;

then use something like

on (press) {
startDrag(_this);
}
on (release) {
stopDrag();
i++;
duplicateMovieClip("_root.draw.smallwheel3","smallwheel3"+i,i);
}

you were making the dupes in the same depth so they were replacing each other

cheers

Sarah012
08-12-2003, 08:56 AM
I added
i=0
to the first frame of the smallwheel3 movieclip.

Then I swithecd my script with the one that you provided, but I am still getting the same results.

Billy T
08-12-2003, 09:00 AM
up the file and I'll take a look

cheers

Sarah012
08-12-2003, 10:21 AM
I am having problems attaching the zip file....its too big. It is also not allowing me to attach the swf file (telling me its not a valid file type?). Any suggestions?

tg
08-12-2003, 10:31 AM
zip it with winzip or some such. make sure its your fla, not your swf.

tg
08-12-2003, 10:34 AM
also, just noticed its not '_this', its just 'this'... unless '_this' is your instance name??

Sarah012
08-12-2003, 10:53 AM
I created a zip file using winzip on a coworkers computer (I'm on a mac), but the resulting file was still too big to be attached. (192K)

I removed the '_' from '(_this)' and now everytime I drag the wheelclip2 movie my computer freezes.

tg
08-12-2003, 11:18 AM
maybe you could post a link to your source on the web somewhere, then folks here could download it.