I’m dynamically generating movies at random locations on the screen and having them scroll across at random speeds.
The last effect I’m trying to add in is an individual fade out of each object. My problem is that the fade is applied to all of the objects uniformly and I want each to fade individually from the time they are created. I was originally thinking I needed a timer that was random but with the random speed as they scroll, the fade time could be the same, it just needs to refresh on each pass. here’s my code, I hope my explanation makes sense. Any help would be appreciated. Thanks!
onClipEvent (load) {
//variables
width = 500;
height = 500;
//random x,y, and alpha
this._yscale = this._xscale=50+Math.random()100;
this._alpha -= 1;
//random x and y for flakes
this._y = -height+Math.random()(3*width);
this._x = -10+Math.random()*width;
//speed and trigonometric value
i = 1+Math.random()*3;
k = -Math.PI+Math.random()*Math.PI;
rad = 0;
}
onClipEvent (enterFrame) {
// horizontal movement
this._x += i;
// remove clips when they misbehave (overstep boundaries)
if (this._y>(height+50)) {
this._y = -45;
this._x = Math.random()*width*2;
}
if (this._y<-50) {
this._y = height+45;
this._x = Math.random()*width*2;
}
if (this._x>=width) {
this._x = -50;
this._y = -height+Math.random()*(3*height);
}
}