Overlapping rain...
Hi I am very new to this and keep getting the problem of the raindrops in my movie overlaps every time the clip loops, and after about 5 loops/plays the rain clutters the stage and
performance/everything is slowing down. How do I restart the rain array animation for every replay? I hope someone can help me in this matter, because I have a client waiting for me to resolve this...
To make myself clear: What I need is the rain to be constant, and not add more and more rain as the replays go on.
Here is the code, it is from the Rain-template in Cs6.
// Number of symbols to add.
const NUM_SYMBOLS:uint = 175;
var symbolsArray:Array = [];
var idx:uint;
var drop:Rain;
for (idx = 0; idx < NUM_SYMBOLS; idx++) {
drop = new Rain();
addChild(drop);
symbolsArray.push(drop);
// Call randomInterval() after 0 to a given ms.
setTimeout(randomInterval, int(Math.random() * 1000), drop);
}
function randomInterval(target:Rain):void {
// Set the current Rain instance's x and y property
target.x = Math.random()* 550-50;
target.y = -Math.random() * 200;
//randomly scale the x and y
var ranScale:Number = Math.random() * 3;
target.scaleX = ranScale;
target.scaleY = ranScale;
var tween:String;
// ranScale is between 0.0 and 1.0
if (ranScale < 1) {
tween = "slow";
// ranScale is between 1.0 and 2.0
} else if (ranScale < 2) {
tween = "medium";
// ranScale is between 2.0 and 3.0
} else {
tween = "fast";
}
//assign tween nested in myClip
myClip[tween].addTarget(target);
Hoping for some solution to keep it nice and constant played as a flashbanner ad.
Kris
