This content has been marked as final. Show 10 replies
1. create a particle and give it a linkage id
2. excute a 1024 iteration for-loop that attached your particle at random locations within your region and store particle references in an array.
2.3. initialize the arrays index and current number
3. start a loop (onEnterFrame or setInterval() ) that iterates each time t and calculates the number of paritcles to remove (the difference between previous and current) and use a for-loop to remove those movieclips.
4. increment the start array index
5. update the current number
How do you deal with fractional particles? The equation gives fractional answers, but, to the best of my knowledge, .4378 of a particle cannot have decayed.
round-off. that number is the result of a probability distribution anyway, not an exact number.
Yeah, I was wondering if there is any benefit to round, floor, or ceil?
doesn't matter until the end when you'll need floor or round.
Wow. Okay, now I just need to learn ActionScript and I'll be able to do this. I have no idea what a linkage ID or an array is. Thanks anyway...
When you create a MovieClip symbol, you will see a box (you might need to click the Advanced button) to Export for Actionscript. Then you can give the exported symbol a name. Don't include spaces or special characters in the name.
If you already have a clip created and didn't give it a name, you can right click on its icon in the library panel and select linkage from the contextual menu.
Remember that even if you don't use the clip in your code it will be included in your swf – making the size and download time larger. So if you later decide not to use a certain clip you should go in and uncheck that box.
Also, I don't think and array is really needed here. You should learn about them, but I don't think for this you need to do it.
I've attached my solution. I made a movieclip with a little round semi-transparent circle on frame one and a stop() on the frame actionscript. Then starting on frame 2 I made a tween of a smaller black dot racing away and fading out. On the final frame of the movieclip I put a stop().
Remember the above is its own movieclip, not on the main timeline. Check its linkage and name it atom.
Then put the code I've attached on Frame 1 of your main timeline.
Try it out and then pick it apart. Let me know what you think.
>>The equation gives fractional answers, but, to the best of my knowledge,
>>.4378 of a particle cannot have decayed.
Why not use alpha, or a color to show decay... that way you can visualize
the decay better anyway.
Adobe Community Expert
Rothrock, you are a god. Thank you so much! I've gotten it to work so far, but now I just need to constrain the particles between discrete x and y coordinates, since I want two sets of different particles decaying side-by-side. I'll let you know how it works.
Also, is there a way to reset this?
Carefully check out the attachMovie method and its arguments. That is where you will see how to constrain the particles.
There is always a way to reset things, but not as it is written – that will be left as an exercise for the reader. :) If you have problems, post back with what you try.