I have a movie clip of my company’s logo in an animation that will serve as a nav bsr for my company’s site, and i want the logo to ‘sparkle’ at random places and intervals.
I’ve created a separate movie clip for the sparkle itself, and i was wondering what kind of code would be needed to make the sparkle clip appear at random spots on the logo.
I’ve tried adding the sparkle to different points on the logo and jumping to their corresponding frames using a random number, but that doesn’t seem to work (its also not as random as i’d like).
can anyone let me know what script needs to be attached to what in order to get this affect?
So, you don’t want random motion, necessarily. You want random placement? If the logo doesn’t move and you have a min/max _x and _y coor; you can tell the movieClip to appear in a certain area.
[AS]
_x=20+Math.random()*80;
_y=10+Math.random()*50;
[/AS]
For example, these formulas will put the _x coor somewhere inbetween 20 and 100; the _y between 10 and 60. The range is the first number (in the equation) to the sum of both numbers.
I hope this helps. This confused me when I first encountered it, but now I use it all the time.
(-:
Here, I’m trying to avoid doing any actual ‘work’ (taxes) today, so I put together a little something to help explain. I would of used action script for the spinning, size, and alpha of the spark, but I figured I’d just use a tween.
I’m still kinda new at this stuff, but I hope this helps.
thanks a bunch, worked perfectly. i chose not to use the duplicate script because it seemed to create multiple sparkles on mine where it didn’t on yours, not so sure why.
in any event, i am in your debt kind sir. probly won’t get to my taxes today either;)
I’m glad I could help!
:beam:
That’s wierd about the dup thing. I did it that way so there wouldn’t be more than one at a time. Wierd. You know, though, if you do want a ton of MC (future ref), you could move that script to the MC’s AS:
[AS]
onClipEvent(load){
_x=blah();
_y=blah();
i++;
}
onClipEvent(enterFrame){
duplicateMovieClip(this, “”+i, i);
}
[/AS]
…I’ll do my taxes tomorrow
(-: