View Full Version : Mouse Trails and duplicateMovieClip.
09-17-2006, 06:14 PM
I've been pulling my hair out trying to get a similar mouse effect as the one in this link:
I know it has something involving duplicateMovieClip and color values of that movie clip, but I'm not getting very far. Something like this might be out of my league at the moment, but I'm still curious as to how I would implement something like these mouse trails that float around. Anyone know of a similar tutorial, or a good place to start? Maybe a synopsis of how this type of thing is achieved?
Thanks for your help.
09-18-2006, 02:58 PM
ok why don't you try to make two movieclips
09-20-2006, 06:01 PM
This is a pretty simple effect, and a good example of what can be achieved with many iterations of the same movieclip.
Basically, a new petal movieclip is created every frame, positioned to the _xmouse and _ymouse positions of the cursor and rotated by an increment. The complexity of the flower is determined completely by the tween inside the base movieclip.
Here is the code for a very simple example. It assumes you have a movieclip in your library with an identifier of "BaseMC". (open your library, right click the movieclip you want to use as a petal, go to Linkage, check Export for Actionscript and change the Identifier field to "BaseMC")
Once your movieclip is linked, place this code on the first frame of your root timeline.
//counter to spin the petals
var rotationCounter:Number = 0;
//every frame we want to create a new petal, so loop this code in an onEnterFrame event.
//create the new clip using _root.getNextHighestDepth() to create a unique name (and depth) for the new petal.
var newClip:MovieClip = _root.attachMovie("baseMC", "mc"+_root.getNextHighestDepth(), _root.getNextHighestDepth());
//rotate the petal
newClip._rotation = rotationCounter;
//position it on the cursor
newClip._x = _root._xmouse;
newClip._y = _root._ymouse;
//increment the rotation for the next petal
rotationCounter += 10;
Also, you'll want to make sure you put:
on the last frame of the petal movieclip to delete the petal after its done tweening.
You can download an example FLA here. Just modify the tween inside of BaseMC to create a better looking flower (its pretty simple)
NOTE: This example uses attachMovie to create new petals, but it could just as easily be done with duplicateMovieClip. I prefer this way because you dont need to create a movieclip to duplicate from, you can just get the movieclip out of the library.
vBulletin® v3.8.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.