im developing a very simple particle system in AS3, i have the particle (a movieclip) and the particle behavior, but now i need a good way to duplicate it n number of times and changing the only value that determine the system behavior, the width, from 10 to 100 px.
This is the code:
//some declarations
var blur:BlurFilter = new BlurFilter();
var filterArray:Array = new Array(blur);
import fl.transitions.Tween;
import fl.transitions.easing.*;
//the only input value, from 10 to 100
par.width=100;
//the equations that define the behavior.
par.alpha=.0088*par.width+.98;
par.height=par.width;
blur.blurX = .75*par.width-.55;
blur.blurY = blur.blurX;
blur.quality = 1;
par.filters = filterArray;
//the movement of the particle
var myTween:Tween = new Tween(par, "y", Strong.easeOut, par.y, stage.stageHeight+2*par.height, -.2*par.width+22, true);
So, as you can see, par is the instance name for the particle, well, i need to duplicate it changing the .width value and eventually the .x value too. Any ideas? Thanks!
This is what OOP (Object Oriented Programming) is all about, and Flash is a great example.
and then in your DocumentClass you could do something like this:
EDIT
Here you go http://d.pr/ycUh. Let me know if you have questions about what is going on. I added some random x and y values for the starting positions of your particles.