I'm making an animation where I need to have a sparkly trail following an object. At first I was animating it, but I realised it would probably look and run better using actionscripted sparkles...
I've looked for various tutorials and found this one (attached) which looks pretty much the way I want my sparkles to look, but it trails the mouse.
Is it possible to change this script to make the sparkles follow a movie clip intance instead of the mouse position and still keep the nice trail effects?
Thanks for the help...it doesn't quite have the desired effect...
I guess the best way to describe what I need to do is, to be able to animate an movieclip object on the stage and have a "pixie dust" effect trailing behind it.
Unfortunatley my brain can't cope with code! Man, I wish I knew how to do this stuff, it's doing my head in now!
If any of you kind souls want to point me in the right direction, I'd appreciate it greatly! (Just remember you have to explain things to me in the manner that you'd use to explain actionscripting to your ageing grandmother!)
Hi,
The following code will attach a movie clip with the Linkage Identifier "spark" to the screen at the position the Movie Clip with the instance name "bug" is. The "spark" MC's will fall and pick up speed as they drop. Once they go beyond 400 pixels (y axis) they get removed from the Stage.
Aww wow, thank you so much for your help and the easy to understand explanation Quixx!
Unfortunately, I'm still using Flash MX and I wasn't able to open your attached file. I just tried using the code in the way you explained in mx and it doesn't seem to be working properly (although I've not been able to see what yours looked like of course
It attaches a 'spark' to the movie clip 'bug' which seems to be doing some small random jiggling movements (that's a technical term!), but it's only attaching the one spark and there wasn't any falling, dropping or picking up speed...
Is the code that you gave specific to mx2004?
Anyways, if you're able to help further that would be very cool, but I don't wan't to be a complete pain in the bum and I really appreciate what you've already done, thanks!
Sorry for the double post, but I figured this might need it. It occured to me that you would probably like to turn the sparks on and off again depending on what's happening during your movie (a slight oversight ). So I made the example a bit more flexible in terms of use. First I'll show you the code, then explain briefly (since I have heavily commented the code in the attachment)...
Okay, so here's the code (no comments here for the sake of posting):
Copy and paste the code above onto the actions panel of the first frame of the Stage.
On the frame you wish your sparks to start falling from the target MC, write: startSpark(targetMC, howFast), where "targetMC" is the MC name, and "howFast" is a number (my example above used an MC I called "bug" at a speed of 40, so it would look like: startSpark(bug, 40)).
Now should you wish to stop the sparks, just place the following code: stopSpark(), on the frame you'd like to stop them.
I'd like to give you credit, if you have a web address message it to me and I'll be sure to link you up
I appreciate it, but no thanks are necessary. I benefit from working on the code as much as you benefit from using/learning from it, as I will often think of new ways to code myself. For example, this code marks the first time I have ever used _global. While I was always aware of the code, I never really thought of a time where I myself would need to use it. But now I do .
did I miss somethign from the code above?? LOL
thanks
Hi Whispers,
Yes. The code above only pertains to what is needed to add the spark trail. If you download the attachment and check out the actions panel for the very last frame, you'll find the following code that allows the bug to start following the mouse. I separated the code from the rest, because I felt putting it on the first frame may cause some confusion for anyone trying to understand the spark trail code.