My experience is, if something doesn’t work quite right, try using variables and variable calls in every possible way to solve the problem. The above syntax is quite a safe option.
I don’t know what it’s supposed to do, but I can tell you why it isn’t doing anything at all for now: you didn’t give the variable i in the for loop a value:
function generateWater(amount, size) {
for (i=0; i<amount; i++) {
ID = _root.createEmptyMovieClip("water"+i, i);
ID.lineStyle(size, 0x0000FF, random(75)+25);
ID.moveTo(_xmouse, _ymouse);
ID.lineTo(_xmouse+5, _ymouse+5);
}
}
generateWater(1, 10);
Wait… now there’s another problem. When the function is called multiple times, evrytime it is called, it just replaces the water drops with new ones. Here is the code: [AS]xoffset = 150;
yoffset = 200;
function generateWater(amount) {
for (i=0; i<amount; i++) {
id = _root.createEmptyMovieClip(“water”+i, i);
id.yspeed = random(20)+20;
id.xspeed = random(10)-5;
id.lineStyle(10, 0x0000FF, random(75)+25);
id.moveTo(xoffset, yoffset);
id.lineTo(xoffset, yoffset+1);
id.onEnterFrame = moveWater;
}
}
function moveWater() {
this._y -= this.yspeed;
this._x += this.xspeed;
this.yspeed -= 3;
}
onEnterFrame = function () {
generateWater(1);
};
[/AS]