PDA

View Full Version : duplicateMC, removeMC ---???--- FMX



andr.in
August 31st, 2002, 05:40 AM
Somebody posted an effect like that in the old forums... but I don't know who it was(I know that his nick started wih "d")
here goes:
I have a movieclip following the mouse.
I want to duplicate it. So there would be like trail following the mouse (duplicateMovieclip)
But I don't want then to be more that 50! (removeMovieClip)
How do I make it so?

Bezzer
August 31st, 2002, 05:51 AM
what i do is that i have an animation that gradualy fades out and then has a removeMovieClip at the end in the movie clip...so this way you duplicate it then it slowly fades and disapears

Probably not the most advanced way but it works for me

the code you would need for duplicate is


onClipEvent(mouseMove){
duplicateMovieClip(_root.myMC,"myMC"+i,i);
++i;
}

Ok that should work :)

andr.in
August 31st, 2002, 07:20 AM
hmm... Why didn't I think of that?
actually I was just looking for the removemovieclip action stuff but I wanted to be sure... thx!

andr.in
August 31st, 2002, 07:38 AM
hmh.. solving that problem causes another!
I was making radnom smooth movement with a trail. It worked fine until I added this: (the bold)


onClipEvent (load) {
MovieClip.prototype.newpos = function() {
_root.newx = random(1024);
_root.newy = random(768);
};
newpos();
}
onClipEvent (enterFrame) {
duplicateMovieClip(_root.ss.circle, "circledup"+d, d);
d++;
_root.xpos = this._x;
_root.ypos = this._y;
_root.ss.circle._x += (_root.newx-_root.xpos)/10;
_root.ss.circle._y += (_root.newy-_root.ypos)/10;
if ((_root.xpos>=_root.newx-10) and (_root.xpos<=_root.newx+10) and (_root.ypos>=_root.newy-10) and (_root.ypos<=_root.newy+10)) {
newpos();
}
d++;
}


It worked fine.. a circle moved smoothly from one point to another, but when I put this code there it started ... I don't know what to call it!
I zipped and attached the fla (it's without the duplicateMC code, you can add it yourself to see what happens)
Any help would be greatly appreciated :-\

andr.in
August 31st, 2002, 07:41 AM
Oops here's the .fla
(forgot to attach :))

Bezzer
September 1st, 2002, 04:38 AM
ur problem is that when u duplicate the movie clip you are also duplicating the actions that go with it...or at least that what i think it is :)

andr.in
September 1st, 2002, 10:04 AM
Works like a charm!
Thanx Bezzer! :):):)